开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜