Before_destroy not called

Hello, I’m trying to intercept delete call in my model but
before_destroy callback is never called…

Somebody knows why ?

Thanks

The controller :

def delete
Image.delete(params[:id])
redirect_to :action => “list”
end

The model :
class Image < ActiveRecord::Base
set_table_name “publish_images”
belongs_to :article
before_destroy :on_destroy

def delete
end

def on_destroy
breakpoint # never hit this bkpoint
end
end

before destroy is called before the destroy() method is called. you’re
not
calling destroy.

try this instead:

The controller :

def delete
Image.destroy(params[:id])
redirect_to :action => “list”
end

The model :
class Image < ActiveRecord::Base
set_table_name “publish_images”
belongs_to :article
before_destroy :on_destroy

private
def on_destroy
breakpoint # never hit this bkpoint
end
end

Fine - I didn’t noticed the difference between destroy and delete, I
tought destroy was an alias to delete.

Thanks a lot !