Get SQL for the Rails 3 Association

I really like how in Rails 3 you can set the scope for your SQL as follows:

User.admins.to_sql

Is there a way to do the same with attitude has_many?:

User.first.jobs.to_sql

I tried User.first.jobs.public_methods.grep /sql/other tricks, but added nothing.

+3
source share
1 answer

User.first.jobs.scoped.to_sql

+4
source

All Articles