Created
February 13, 2015 17:41
-
-
Save Chryus/d2ff4b2ba52ad8809fd0 to your computer and use it in GitHub Desktop.
run_callbacks example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy(mode=:soft) | |
run_callbacks :destroy do | |
if mode == :hard | |
super() | |
else | |
update(deleted_at: Time.zone.now) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment