Return to Snippet

Revision: 26558
at April 30, 2010 13:43 by stayce


Initial Code
validate :price_must_be_at_least_a_cent

protected 
def price_must_be_at_least_a_cent
  errors.add(:price, 'should be at least 0.01') if price.nil? || price < 0.01
end

Initial URL

                                

Initial Description
validate :price_must_be_at_least_a_cent
protected def price_must_be_at_least_a_cent
errors.add(:price, 'should be at least 0.01') if price.nil? || price < 0.01
end

Initial Title
validate with errors

Initial Tags
rails, ruby

Initial Language
Ruby