we are upgrading from rails 2.3 to rails 3 and we have some validation on a model like:
validates_length_of :corporate_type, :in => 1..255, :allow_blank => false, :on => :update, :if => Proc.new { |rra| rra.show_corporate_type? }
In rails 2.3 this only gets called on update, but in rails 3, it seems to be called on create, which breaks some stuff downstream… Can someone explain why this is getting called on create?
Here is the stack:
app/models/rra_agreement.rb:11:in `block in <class:RRAAgreement>'
app/models/foo_application_delegate.rb:29:in `create_application'
Line 28 and 29 are:
rra = RRAAgreement.new()
rra.save
line 11 is the validation line above
thanks
Joel
The syntax is changed for rails 3, try this to call only on update,