This project is archived and is in readonly mode.
activerecord 2.1.0 deletion callback wont work anymore
-
tophe
- Tag set to 2.1, activerecord, callback, delete
hi guy.
I have just finded were was the probleme. and by the way that's not a bug.
in fact the relation was declared with a dependent => :destroy.
that functionality wasn't working with rails 2.0.2, and when i do the upgrade to rails 2.1.0, the dependent tag was played before, the deletion happend.
so the older code dont work anymore.
class Sale < Base
belongs_to :address,
:dependent => :destroy
def before_destroy
raise "can't destroy sale.id = #{self.id} linked lot exist" if Lot.count(:conditions => ['idsale = ?',self.id]) >0
end
i have simply remove the depend relation and everything works !
-
Jeremy Kemper
- State changed from new to resolved