Created
March 27, 2012 11:08
-
-
Save Wardrop/2214994 to your computer and use it in GitHub Desktop.
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
# Current Validation Strategy | |
validates_presence :place_id | |
errors.add(:place, "must have a parent") unless place.parent_id | |
# Improved Validation Strategy | |
validates_presence :place_id | |
validates :place, "must have a parent" { place.parent_id } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment