Take the 2-minute tour ×

I am using resources :users in routes.rb. This provides the following paths as rake routes unveils.

users     GET    /users(.:format)           {:action=>"index", :controller=>"users"}

Further, I comment out the legacy wild controller route.


To add a delete link on my users page I add the following.

<%= link_to "Delete user", user, :method => :delete, :confirm => "Are you sure?" %>

This generated the following html code.

<a href="/users/42" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete user</a>

I click the link and it takes me to the show page?! What's wrong?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You need to include the default Javascript files for that to work properly:

<%= javascript_include_tag :defaults %>
share|improve this answer
wtf! this took me like hours if not days. so bad it is not written down anywhere. thank you very much! –  JJD Mar 29 '11 at 21:38
Since this worked for you, please accept the answer, thanks :). Also, if you're using jQuery, you should include the jquery-ujs file instead. –  Andrew Marshall Mar 29 '11 at 21:43
I will I will. There is a time limit on StackOverflow that pauses me to check your answer as correct. You are to fast for SO :} –  JJD Mar 29 '11 at 21:45
add comment

Your Answer


