I can not understand why the hooks do not work. I have the following model:
class DirItem include DataMapper::Resource # property <name>, <type> property :id, Serial property :dir_cat_id, Integer, :required => true property :title, String, :required => true property :price, Integer, :default => 0 belongs_to :dir_cat has n, :dir_photos has n, :dir_field_values before :destroy do logger.debug "==============DESTROYING ITEM ##{id}, TITLE #{title}" dir_field_values.destroy dir_photos.destroy end end
When I call the destroy method either from my application or from irb, it returns false . The errors hash is empty, the log message is not printed, and the record is not deleted.
source share