次のような非常に単純なレンダリングがあります。
<%= form_for(:relationships, :url => relationships_path, :html => {:method => 'delete'}) do |f| %>
<div><%= f.hidden_field :user_id_to_unfollow, :value => @user.id %></div>
<div class="actions"><%= f.submit "Unfollow" %></div>
<% end %>
このフォームを送信すると、常に
Routing Error
No route matches "/relationships"
マイページで。
リレーションシップ コントローラーで、すべての適切なメソッドを作成しました。
def create
...
end
def destroy
...
end
def update
...
end
def show
...
end
そして、ルート構成で、関係コントローラーのすべてのルートを許可するようにしました
resources :relationships
しかし、コントローラーのdestroyメソッドに入ることができないようです:(
ただし、削除すると
:html => {:method => 'delete'}
form_for の method パラメータを指定すると、コントローラ no pb の create メソッドにたどり着きます。
理解できません....
アレックス
ps: これは、リレーションシップのレーキ ルートの結果です。
relationships GET /relationships(.:format) {:action=>"index", :controller=>"relationships"}
POST /relationships(.:format) {:action=>"create", :controller=>"relationships"}