I'd like a way to work with raw data as it was returned by a SQL query. 
Mostly because Rails' eager loading has a penchant for not working with 
ActiveRecord::QueryMethods.select, losing useful data in the process.

As for Arel and #to_sql... Why wasn't it made public? Consider that 
ActiveRecord doesn't even have a convenient interface for writing greater 
than/less than queries. Arel could be an answer to this problem, and more.

понедельник, 14 марта 2016 г., 21:45:51 UTC+3 пользователь lingceng написал:
>
> I know it's been a long time from the last reply.
> But I really want some method return raw results in ActiveRecord.
>
> Actually I use ActiveRecord as a sql builder for some complex query. And 
> it's useful in most cases.
> I added a patch for my project to do the following query:
>
>     PayRecord.group(:settlement_id, :pm).having('count(*) > 
> 1').select("count(*), id, settlement_id, pm").select_all
>
> Here's the patch
>   
>     class ActiveRecord::Relation
>       def select_all
>         @klass.connection.select_all(self.to_sql)
>       end
>     end
>
> @Rafael Mendonça França What's the schedule of this feature?
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to