X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/fd484b33a3920e0031007c5c2f1dec61913cbab5..c992f015ed80cab29bd0f4b6cdd0ddbc1d00d304:/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