Skip to content

Instantly share code, notes, and snippets.

@ddollar
Created March 26, 2009 20:41
Show Gist options
  • Select an option

  • Save ddollar/86318 to your computer and use it in GitHub Desktop.

Select an option

Save ddollar/86318 to your computer and use it in GitHub Desktop.
validate :custom_validation_method
def custom_validation_method
if parent_object.has_stuff? && name.blank?
errors.add :name, 'should not be blank when parent object has stuff'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment