我一直试图建立一个更改布尔值的链接,但错误后收到错误。我以为我已经弄清楚了,但是当我点击链接Couldn't find Clue with 'id'=Clue
并显示ActiveRecord::RecordNotFound in ClueController#update_clue1
时。感谢所有帮助
我的路线
resources :clue do
member do
get :update_clue1
put :update_clue1
end
end
控制器
def update_clue1
@clue = Clue.find(params[:id])
@clue.update_attributes(clue1: true)
redirect_to "/home/clues"
end
查看
<%= link_to "See next clue", update_clue1_clue_path(Clue), method: :put %>