这是我的尝试:
class Answer < ActiveRecord::Base
validate :upd
def upd
unless question_id.nil? || status.nil?
redirect_to :action => 'index'
else return true
end
def update_status(question_id, status)
if question.valid? && status.valid?
@update = Question.find(question_id)
@update.update_attributes(:question_status => status)
end
end
end
我得到未定义的局部变量或方法`status'