1
我試圖在多步向導(使用邪惡的寶石和這個GUIDE)上設置驗證。第一步我輸入一些用戶信息(使用設計+註冊),但是當我認爲我得到以下錯誤:多步向導中的驗證
NoMethodError in RegistrationsController#create
undefined method `include?' for nil:NilClass
Rails.root: /Users/nelsonkeating/Desktop/remindeal1
Application Trace | Framework Trace | Full Trace
app/models/user.rb:54:in `active_or_address?'
Class User
validates_presence_of :address, :presence => true, :if => :active_or_address?
def active_or_address?
status.include?('address') || active?
end
def active?
status == 'active'
end
哪裏是「狀態」申報?它是零,所以你不能調用它的功能,對吧?或者該變量包含在內? – 2012-11-06 20:48:42