Savings records that fail validation.
Tuesday, June 9th, 2009 By: DanielSo I had this problem with a record that was being saved even though it failed validation:
cc = CreditCard.new(:card_number => 'invalid') >> cc.save => false >> cc.id => 3
That one had me stumped for a while until I realized I was carelessly using update_attribute in my custom writer:
def card_number=(num) update_attribute(:crypted_card_number, encrypt(num)) end
And we all know that update_attribute “saves the record without going through the normal validation procedure.”
Everything worked much nicer after I changed the code to:
def card_number=(num) self.crypted_card_number = encrypt(num) end

The Sevier River Water Users Association (SRWUA) in Central Utah are pioneers in the use of the Real-Time Web. For the past 10 years SRWUA has been delivering real-time water flow data to the public via the website www.SevierRiver.org.
More that 100 remote, solar-powered, stations record wate...