I'm trying to set up a simple soft delete system by adding a before_destroy
callback which sets the deleted flag and then returns false (to prevent real destroy from happening).
class Project < ActiveRecord::Base
belongs_to :user
before_destroy :soft_delete
def soft_delete
self.update( is_deleted: 1 )
false
end
end
This does not result in the record getting updated. I'm not sure why. I see [1m[36m (0.4ms)[0m [1mROLLBACK[0m
in my logs, but I'm not sure it's relevant or not.