My route.rb:
------------
*resources :accounts, :path => "expos" do
resources :shows, :path => "events" do
resources :show_sessions, :path => "session"
end
end*
<% @events.each do |e| %>
<%= link_to '<i class=icon-trash></i>'.html_safe, account_show_path(@context.id, e), :confirm => 'Are you sure?', :method => :delete %>
<% end %>
Rake Routes:
account_shows GET /expos/:account_id/events(.:format) {:action=>"index", :controller=>"shows"}
POST /expos/:account_id/events(.:format) {:action=>"create", :controller=>"shows"}
new_account_show GET /expos/:account_id/events/new(.:format) {:action=>"new", :controller=>"shows"}
edit_account_show GET /expos/:account_id/events/:id/edit(.:format) {:action=>"edit", :controller=>"shows"}
account_show GET /expos/:account_id/events/:id(.:format) {:action=>"show", :controller=>"shows"}
PUT /expos/:account_id/events/:id(.:format) {:action=>"update", :controller=>"shows"}
DELETE /expos/:account_id/events/:id(.:format) {:action=>"destroy", :controller=>"shows"}
我有删除路线。但我得到“只允许获取和发布请求”。请帮助任何人为什么我会收到错误。
答案 0 :(得分:-1)
尝试将其更改为此内容;
<% @events.each do |e| %>
<%= link_to '<i class=icon-trash></i>'.html_safe, account_show_path(@context, @event), :confirm => 'Are you sure?', :method => :delete %>
<% end %>
确保标题中包含以下内容;
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>