Trying to find some way to restrict deletion of ActiveRecord objects
if there dependent records.
I'm thinking of using before_destroy for it, but don't know how to
"cancel" deletion in my code in before_destroy "decides" that deletion
should be restricted.
Trying to find some way to restrict deletion of ActiveRecord objects
if there dependent records.
I'm thinking of using before_destroy for it, but don't know how to
"cancel" deletion in my code in before_destroy "decides" that deletion
should be restricted.
I'm pretty sure that if a "before_" filter returns false, the whole action is canceled. Check the class docs at api.rubyonrails.org to be sure.