X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/fd484b33a3920e0031007c5c2f1dec61913cbab5..b717fb1eab4f06d25f195a74c71806484ce0fd57:/app/models/candidate.rb?ds=sidebyside diff --git a/app/models/candidate.rb b/app/models/candidate.rb index 7b6e802..430b6ab 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -1,8 +1,9 @@ class Candidate < ActiveRecord::Base belongs_to :election - validates_uniqueness_of :name validates_presence_of :name + # validate uniqueness of a name *within a given election* + def <=>(other) self.name <=> other.name end