Newbie problem with destroy

Hello,

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 => entry.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?

Thanks!

croceldon :

Couldn’t find Entry without an ID

the :id => entry.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 => entry.id}, :post =>
true %>

it can be written like that as well :

<%= link_to ‘delete’, { :action => “destroy”, :id => entry.id}, {
:post => true } %>

-- Jean-François.


À la renverse.

<%= link_to ‘delete’, { :action => “destroy”, :id => entry.id}, :post =>
true %>

That did it.

Thanks so much!