开发者

How to do a Rails 3 join query?

I have the following model

class User < ActiveRecord::Base
  has_many :assignments
  has_many :roles, :through => :assignments
  has_one :profile
end

How wou开发者_JAVA技巧ld I do and active record query to select profiles of users with a particular role?


.includes(:relation) might be useful

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜