X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/fd484b33a3920e0031007c5c2f1dec61913cbab5..b8482ad1846436439b9ef3ba0ddcb3b42588d916:/app/models/candidate.rb diff --git a/app/models/candidate.rb b/app/models/candidate.rb old mode 100644 new mode 100755 index 7b6e802..430b6ab --- 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