HTML フォームを使用せずに、リソースを更新するためのリンクが必要です。
ルート:
resources :users do
resources :friends
end
レーキ ルート:
user_friend GET /users/:user_id/friends/:id(.:format){:action=>"show", :controller=>"friends"}
PUT /users/:user_id/friends/:id(.:format){:action=>"update", :controller=>"friends"}
put を使用して、次のような単純なリンクで友達を更新したいと思います。
<%= link_to "Add as friend", user_friend_path(current_user, :method=>'put') %>
しかし、リンクをクリックすると、show アクションに入ろうとします。
これを行う正しい方法は何ですか?