我有一个非常简单的渲染,如下所示:
<%= 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
但我似乎无法进入控制器的破坏方法:(
但是,如果我删除
:html => {:method => 'delete'}
form_for 中的方法参数然后我得到控制器没有 pb 的创建方法。
我不明白......
亚历克斯
ps:这是关系的 rake 路由结果:
relationships GET /relationships(.:format) {:action=>"index", :controller=>"relationships"}
POST /relationships(.:format) {:action=>"create", :controller=>"relationships"}