Forum: Ruby on Rails what's happened with the destroy action

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Fa342466c787830ea65ffc638d22d9c4?d=identicon&s=25 GG9 Rails (gorter9)
on 2007-01-02 14:23
I'am a beginner in programming world and i'am now several weeks learning
Ruby on Rails.
everything goes well exept the action destroy.
I'am using the screencasts to learning programming and the old edition
of the book Agile Web development with rails.

In some cases the action destroy works well in others it doesn't work.
I made the code exactly as in the book but after that the destroy action
doesn't work anymore.

I have did the screencast of the weblog and made a Administrator login
it works well.
Only the destroycomment works different.
I must have for the destroycomment a seperate controller named
Comment_Controller to use the action destroycomment. Only i can't figure
out why it works different.

And now with making the depot from the Agile book and i get the same
strange things.

Please can someone tell me wht exatly changed with the destroy action.
I think now this action is changed since the book and the screencasts.
But i have not the expierience yet to find ut how i must use it now.
Ce953bec3af375ddc75e375233112b28?d=identicon&s=25 harper (Guest)
on 2007-01-03 09:56
imho, (only out of past experiences) i believe it's because of these two
lines in your controller:

  verify :method => :post, :only => [ :destroy ... ],
  :redirect_to => { :action => :list }

this 'verify' function redirects to a different page, rather than put
the request through, if the action specified in the :only => [:action1,
:action2, ...] array.
the way to do it, is when you link over to the 'destroy' action, add a
{:post => true } option or method="post" html attribute to the link:

<%= link_to "destroy the object", ({:action => 'destroy', :id =>
@object}, :post => true  )%>

<a href="/controller/action" method="post">destroy!</a>



This topic is locked and can not be replied to.