Friday, January 20, 2006

Deleting a row using delete

When we add a delete link



<%= link_to "(delete)",
{:action => "delete", :id => site.id},
:confirm => "Really delete #{site.title}?" %>



We get the error
“Unknown action”

However, when we create a destroy link, it works.

If we want to keep the delete link, we must add the action.

def delete
Site.find(@params['id']).destroy
redirect_to :action => 'list'
end

0 Comments:

Post a Comment

<< Home

eXTReMe Tracker