Link_to使布尔值为true

时间:2015-04-15 00:11:06

标签: ruby-on-rails

我一直试图建立一个更改布尔值的链接,但错误后收到错误。我以为我已经弄清楚了,但是当我点击链接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 %>

0 个答案:

没有答案