我想通過我的截止時間屬性創建一個範圍,可以在我的模型中找到例如less_than_a_year,less_than_six_month的數據集。Rails 3.2模型範圍日期less_than_a_
class Goal < ActiveRecord::Base
attr_accessible :category, :title, :detail, :deadline, :achieve
#need help solving this
scope :less_than_a_year, where()
end
所以它會執行goal.less_than_a_year並提供一年以下的數據列表。 謝謝。
你忘了?和拼寫錯誤的lambda – mraaroncruz 2013-03-19 14:54:13