Newbie problem with destroy


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?


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.

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

That did it.

Thanks so much!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs