0
ItemType
중 하나 일 수있는 Item
개체가 있습니다. ItemType
은 attribute
이며 true
또는 false
입니다. 순간 관련 모델 특성을 사용하여 개체를 반환하는 중
Class Item
belongs_to :item_type
end
Class ItemType
has_many :items
end
, 난 그냥 일반적인 방법으로 마지막
x
물체를 잡는 오전 :
latest_items = Item.last(x)
을 지금, 나는이 ItemType
가에 attribute
세트가 x
Items
의 목록을 반환해야 이 (의사) 같은 true
뭔가 :
latest_items = Item.last(x).where(Item.item_type.attribute = "true")
는 R이 쉽게 달성 에일? 똑바로 앞으로해야 것 같다,하지만 난 솔루션
가 완벽하게 작동 사용하여 쉽게 할 수 - 매우 –
을 덕분에 당신은 환영합니다 :) –