search for: third_hurdle

Displaying 1 result from an estimated 1 matches for "third_hurdle".

2012 Aug 05
0
ActiveRecord::Validator vs ActiveModel::Validator
...(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) rand > 0.3 end def second_hurdle(record) rand > 0.6 end def third_hurdle(record) rand > 0.9 end end class Report < ActiveRecord::Base validates_with RandomlyValidator end thanks for response -- You receiv...