Is there any way to use MySQL UNION in Rails 3?
I think the only way you're going to get this to work by directly executing the query.
ActiveRecord::Base.connection.execute("SELECT REPEAT('a',1) UNION SELECT REPEAT('b',10)")
This returns an ActiveRecord resultset. If you want the results wrapped in a model do something like this:
MyModel.find_by_sql("...")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With