如何进行Rails 3加入查询?

时间:2010-12-21 00:45:37

标签: ruby-on-rails activerecord join ruby-on-rails-3 one-to-one

我有以下型号

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

我如何进行活动记录查询以选择具有特定角色的用户的个人资料?

1 个答案:

答案 0 :(得分:0)

.includes(:relation)可能有用