Destroy doesn't destroy!

I’m using a MySQL server and the user my rails app is logging in as is
root;
root has all permissions.

My destroy code is default scaffolding:

def destroy
Customer.find(params[:id]).destroy
redirect_to :action => ‘list’
end

Why is

<%= link_to ‘Destroy’, :action => ‘destroy’, :id => @customer %>

not destroying the SQL row? @customer is the correct id.

Any ideas?

  • David

Cuz you be missing .id on the :id => @customer param. I’m not sure if
@customer returns a different number (4 I think), and as a result you
may have destroyed a different record. Surprised there wasn’t an error
or warning.

Joe

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