[Rails] Re: validate not called on update_attribute

Pete
Fri, 23 Jun 2006 09:48:06 -0000

Hi guys,

when calling update_attribute on my model I wonder that the
validate-method is not called.

class Product < ActiveRecord::Base
 validates_presence_of :name
 def validate
   # do some more or less sophisticated checks
 end
end

product = Product.create(:name => "Fridge")
# validate happens

product.update_attribute(:name => "Mega-Cool-Master 2000ZX")
# _no_ validate happens here :-(


Thanks for your time and help in advance! :-)

Best regards
Peter