Created
August 3, 2015 13:25
-
-
Save tbprojects/6c1979967ebdf17d71c3 to your computer and use it in GitHub Desktop.
When order does matter...
This file contains 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
# GOOD - check if can object be destroyed and when it's possible destroy associated objects :-) | |
before_destroy :can_be_removed? | |
has_many :custom_values, dependent: :destroy | |
# BAD - destroys associated objects and then check if object can be destroyed :-( | |
has_many :custom_values, dependent: :destroy | |
before_destroy :can_be_removed? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment