class QuickVote < Election
before_validation :build_candidate_names
- after_validation :create_candidates
validates_uniqueness_of :name
attr_accessor :candidate_names
def build_candidate_names
@candidate_names ||= []
- if @candidate_names.empty? and not candidates.empty?
- @candidate_names = candidates.collect {|c| c.name}
+ if @candidate_names.empty? and not self.candidates.empty?
+ @candidate_names = self.candidates.collect {|c| c.name}
end
end