This is my index: <td><%= link_to ''Remove'', user, :class => "list-actions", :confirm => ''Are you sure?'', :method => :delete %></td> And this is my controller: def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to(users_url) } format.xml { head :ok } end end For some reason, when I click on the ''Remove'' link, it directs me to the ''Show'' action and does not destroy the item... strange ?? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Justin, Justin To wrote:> For some reason, <...>The reason would be found in routes.rb. You can experiment, to good effect, with script/console. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Quoting Justin To <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > This is my index: > > <td><%= link_to ''Remove'', user, > :class => "list-actions", :confirm => ''Are you sure?'', > :method => :delete %></td> > > And this is my controller: > > def destroy > @user = User.find(params[:id]) > @user.destroy > > respond_to do |format| > format.html { redirect_to(users_url) } > format.xml { head :ok } > end > end > > For some reason, when I click on the ''Remove'' link, it directs me to the > ''Show'' action and does not destroy the item... strange ??The delete action/method does not invoke the destroy method. If you want destroy, put it in the link. Unless you explicitly it in config/routes.rb. HTH, Jeffrey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---