Forum: Ruby on Rails Newbie problem with destroy

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.
74bd868b70df3590bf94cf7abe563ec4?d=identicon&s=25 croceldon (Guest)
on 2007-01-10 01:04

I am very new at this, so please keep that in mind.

I made a web application using scaffold and ruby on rails.  It's just a
very basic blog that I'm using for testing and learning.

Everything's going great, except when I want to delete an entry.  Here's
my code for the delete link:

<%= link_to 'delete', { :action => "destroy" }, :id =>, :post
=> true %>

When I click this link, I get an error with the following error:

Couldn't find Entry without an ID

Any ideas on what I'm doing wrong?

13ea48f056b19349027d2f4a6921a46a?d=identicon&s=25 Jean-François (Guest)
on 2007-01-10 01:13
(Received via mailing list)
croceldon :
> Couldn't find Entry without an ID

the :id => pair is in the wrong hash : you put in the last
one whereas it must be in the first one :

<%= link_to 'delete', { :action => "destroy", :id =>}, :post =>
true %>

it can be written like that as well :

<%= link_to 'delete', { :action => "destroy", :id =>}, {
:post => true } %>

    -- Jean-François.

À la renverse.
74bd868b70df3590bf94cf7abe563ec4?d=identicon&s=25 croceldon (Guest)
on 2007-01-10 01:37
> <%= link_to 'delete', { :action => "destroy", :id =>}, :post =>
> true %>

That did it.

Thanks so much!
This topic is locked and can not be replied to.