Get the SQL for a Rails 3 Association
I really like how in Rails 3 you can ask a scope for its SQL like this:
User.admins.to_sql
Is there any way to do the same thing with a has_many
relation?:
User.first.jobs.to_sql
I've tried User.first.jobs.public开发者_运维技巧_methods.grep /sql/
and other tricks, but I haven't turned up anything.
User.first.jobs.scoped.to_sql
精彩评论