X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/fd484b33a3920e0031007c5c2f1dec61913cbab5..d207da8dfc3f315f7758d1f5307c700ce4c25156:/app/models/candidate.rb 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