Skip to content

Instantly share code, notes, and snippets.

@neaf
Created April 29, 2009 16:01
Show Gist options
  • Select an option

  • Save neaf/103865 to your computer and use it in GitHub Desktop.

Select an option

Save neaf/103865 to your computer and use it in GitHub Desktop.
class Match < Sequel::Model
validates do
presence_of :first_player_id
presence_of :second_player_id
presence_of :happens_at
presence_of :sport_id
end
def validate
super
errors.add(:second_player_id, 'Selected teams have to be different.') if first_player_id == second_player_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment