Skip to content

Instantly share code, notes, and snippets.

@matthodan
Created December 1, 2010 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthodan/722751 to your computer and use it in GitHub Desktop.
Save matthodan/722751 to your computer and use it in GitHub Desktop.
class User < ActiveRecord:Base
validate :user_is_happy_and_broke
private
def user_is_happy_and_broke
if self.state_of_mind != 'happy' || self.fiscal_status != 'broke'
errors.add :user_not_happy_and_broke, 'User must be happy and broke to continue'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment