我的关系如下。
companies_employee.rb
belongs_to :employee
belongs_to :company
validates_presence_of :role
employee.rb
has_many :companies_employees
has_many :companies, :through => :companies_employees
company.rb
has_many :companies_employees
has_many :managers, :through => :companies_employees, :source => :employee, conditions => {:role => "Manager"}
has_many :owners, :through => :companies_employees, :source => :employee, :conditions => {:role => "Owner"}
我的问题是,当它检查条件时,它试图在employees 表中找到角色列,但角色列在company_employees 表中。有没有办法让它使用这个表中的东西来满足条件?