ruby on rails - link_to not working and getting Page not found Only get and post requests are allowed -
ruby on rails - link_to not working and getting Page not found Only get and post requests are allowed -
my route.rb: ------------ *resources :accounts, :path => "expos" resources :shows, :path => "events" resources :show_sessions, :path => "session" end end* <% @events.each |e| %> <%= link_to '<i class=icon-trash></i>'.html_safe, account_show_path(@context.id, e), :confirm => 'are sure?', :method => :delete %> <% end %>
rake routes:
account_shows /expos/:account_id/events(.:format) {:action=>"index", :controller=>"shows"} post /expos/:account_id/events(.:format) {:action=>"create", :controller=>"shows"} new_account_show /expos/:account_id/events/new(.:format) {:action=>"new", :controller=>"shows"} edit_account_show /expos/:account_id/events/:id/edit(.:format) {:action=>"edit", :controller=>"shows"} account_show /expos/:account_id/events/:id(.:format) {:action=>"show", :controller=>"shows"} set /expos/:account_id/events/:id(.:format) {:action=>"update", :controller=>"shows"} delete /expos/:account_id/events/:id(.:format) {:action=>"destroy", :controller=>"shows"}
i have delete route. getting "only , post requests allowed". please help why getting error.
try changing this;
<% @events.each |e| %> <%= link_to '<i class=icon-trash></i>'.html_safe, account_show_path(@context, @event), :confirm => 'are sure?', :method => :delete %> <% end %>
make sure have next in header;
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %>
ruby-on-rails ruby
Comments
Post a Comment