I'm not sure what you mean by a "dirty" user model, but you can do this using the attr_accessor method . This will allow you to create an attribute for the model that you can use to validate:
class Widget < ActiveRecord::Base attr_accessor :confirmation_email validates_length_of :confirmation_email, :within => 1..10 end
To check only at a specific time, you can use the condition :if :
validates_length_of :confirmation_email, :within => 1..10, :if => Proc.new { |widget| widget.creation_step > 2 }
You can also use the class method, for example :if => :payment_complete . With their help, you can achieve the necessary functionality. As far as I know, there is no more concise way.
source share