]> projects.mako.cc - selectricity/blobdiff - app/models/candidate.rb
Fix validation of candidate names
[selectricity] / app / models / candidate.rb
index 7af978afb3f95e422d035b780f4e4519f7fb8021..430b6ab22762223a728eaf6cc27bb3d51f7b8d2e 100644 (file)
@@ -1,6 +1,8 @@
 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 

Benjamin Mako Hill || Want to submit a patch?