Rails 3 destroy link not working?

You probably need to change it to something like.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

My destroy link is not working. My index view: true %> My konkurrencer partial: :delete %> And I get this error: No route matches {:action=>"show", :controller=>"admin/konkurrancers", :id=>#"show", :controller=>"admin/konkurrancers", :id=>#} Extracted source (around line #59): 56: 57: 58: 'edit', :id => konkurrancer. Id}, :class => 'action edit' %> 59: :delete %> 60: 61: 62: Rake routes: delete_multiple_admin_konkurrancers DELETE /admin/konkurrancers/delete_multiple( .

:format) {:action=>"delete_multiple", :controller=>"admin/konkurrancers"} admin_konkurrancers GET /admin/konkurrancers(.:format) {:action=>"index", :controller=>"admin/konkurrancers"} POST /admin/konkurrancers(.:format) {:action=>"create", :controller=>"admin/konkurrancers"} new_admin_konkurrancer GET /admin/konkurrancers/new(.:format) {:action=>"new", :controller=>"admin/konkurrancers"} edit_admin_konkurrancer GET /admin/konkurrancers/:id/edit(.:forma t) {:action=>"edit", :controller=>"admin/konkurrancers"} admin_konkurrancer GET /admin/konkurrancers/:id(.:format) {:action=>"show", :controller=>"admin/konkurrancers"} PUT /admin/konkurrancers/:id(.:format) {:action=>"update", :controller=>"admin/konkurrancers"} DELETE /admin/konkurrancers/:id(.:format) {:action=>"destroy", :controller=>"admin/konkurrancers"} My route file: namespace :admin do resources :tags resources :kategoris resources :konkurrancers do collection do delete :delete_multiple end end resources :reklamers end ruby-on-rails ruby ruby-on-rails-3 actionview link|improve this question edited Jun 2 '11 at 12:04 asked May 26 '11 at 7:12Rails beginner1,0511329 89% accept rate.

You probably need to change it to something like: 'destroy', :id => konkurrancer. Id, :method => :delete %> or if you use RESTful routes, something like : konkurrancer. Id), :method => :delete %.

It just render the show action. My url is 5? Method=destroy – Rails beginner May 26 '11 at 7:22 I have tried both solutions - They are not working.

The first renders the show page and the 2nd renders a route error – Rails beginner May 31 '11 at 15:59 You do not have correct routes. You need something like "scope :path => '/your_path', :controller => :your_controller do delete 'your_url' => :destroy, :as => 'destroy_konkurrancer' end" in your routes. Rb for the second one to work(fix your_ appropriately).

– SpyrosP May 31 '11 at 16:23 I have updated my question with my route. Rb – Rails beginner May 31 '11 at 16:26 Nobody that have an answer to this problem? Is there more information I can provide to solve this problem?

– Rails beginner May 31 '11 at 12:04.

In case you're using RESTful resources, try this: :delete %.

– Kris May 26 '11 at 10:39 I get the error: undefined method `konkurrancer_path'. I have updated my question with your 2nd solution – Rails beginner May 26 '11 at 10:52 @Rails beginner: can you provide us with the output of rake routes? – Kris May 27 '11 at 11:46.

When working with namespaced controllers and routes, you have to use namespaced models in order for the link_to helpers to function properly. When I write extra admin pages for models, I also generate some wrapper models in the admin namespace. E.g.

, in app/models/admin/person. Rb class Admin::Person.

In case of RESTful resources, try this: { :delete %>} and use appropriate javascript helper. This is problem of javascript-helper of rails. You need to use rails.

Js appropriately. If you use prototype. Js then in rails.

Js you need prototype helpers methods else if you use jquery then you need rails jquery helper.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions