我有以下兩種模式:Rails的 - 該協會最新訂購
class Shelf < ActiveRecord::Model
has_many :wines
def self.order_by_oldest_bottle_of_wine
#TODO: order by the oldest wine bottle...
end
end
class Wine < ActiveRecord::Model
belongs_to :shelf
attr_accessible :produce_date
end
在貨架的模式,我想訂購由最古老的葡萄酒瓶雜誌架架子上(即最古老的葡萄酒瓶架第一),但並非100%肯定的實施。
非常感謝,
理想,我想活動記錄進行排序而不是訴諸簡單的排序。 – alexs333
嗨。我已更新有效記錄。 – vijikumar