Displaying 1 result from an estimated 1 matches for "first_hurdle".
2012 Aug 05
0
ActiveRecord::Validator vs ActiveModel::Validator
...validates_with EmailValidator, :attr => :email
end
Where is this ActiveRecord::Validator coming from? Also why does it
exist when you can simply do this in ActiveModel:
class RandomlyValidator < ActiveModel::Validator
def validate(record)
record.errors[:base] << “FAIL #1” unless first_hurdle(record) #add
error messages to the whole object instead of a particular attribute
using the :base key.
record.errors[:base] << “Fail #2” unless second_hurdle(record)
record.errors[:base] << “Fail #3” unless third_hurdle(record)
end
private
def first_hurdle(record)
ra...