Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User
- before_destroy :destroy_memberships
- has_many :memberships
- def destroy_memberships(record)
- record.memberships.destroy_all if condition_satisfied?
- true
- end
- def condition_satisfied?
- # ...
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment