【发布时间】:2013-06-25 14:22:47
【问题描述】:
此时我需要为我的数据库中的列分配一个值 我正在使用 Rails 4.0
我在视图中有这个链接:
link_to 'Finalizar', note_finalizar_path(note), class: 'btn btn-success btn-mini'
我在控制器中有一个这样的方法:
def finalizar
@note = Note.where(:id => Note.id).first
if @note.update_column(:estado, false)
redirect_to notes_path, :notice => "OK"
else
redirect_to notes_path, :notice => "NO"
end
end
问题是,当我点击按钮时,我得到了这个错误:
undefined method `id' for #Class:0xa675070>
抱歉,我的英语不是我的母语,感谢您的帮助。
【问题讨论】:
标签: ruby-on-rails ruby button ruby-on-rails-4