1
我有一个Shift
和Type
表具有以下关系:遍历对象找到匹配
class Shift < ActiveRecord::Base
belongs_to :type
end
class Type < ActiveRecord::Base
has_many :shifts, :dependent => :destroy
end
的Type
表有一个属性,叫做Unassignable
。
我愿做一个查询返回所有属于Type
其中Unassignable
属性是true
的Shifts
..
喜欢的东西: Shift.where(:shift.type.unassignable =>真)
任何帮助:)
感谢
简单,但只是我需要的一个:) – Twiddr