我使用Ruby和我在我的對象類創建了幾個範圍,但是當我把他們從我的代碼中返回一個錯誤:聲明範圍不on Rails的3個工作
irb>Transaction.first.committed
=> undefined method `commited' for #
對象類:
class Transaction < ActiveRecord::Base
attr_accessible :amount, :description, :published, :task_description_id, :discrete_task_id, :transaction_type belongs_to :discrete_task scope :committed, where(:transaction_type => "committed") scope :obligated, where(:transaction_type => "obligated") scope :expensed, where(:transaction_type => "expensed")
end
感謝您的幫助球員。 – 2012-07-05 18:10:44