Validate some fields only on object creation, not update

I’m having a problem with my User model. Originally I had alot of
validation, including this:

validates_presence_of :password_confirmation, :password
validates_length_of :password, :within => 4…50
validates_confirmation_of :password

However, this made it impossible to edit a user without setting his
password, which I don’t want. So I tried to isolate the above
validations in the before_create method, but that didn’t work too well:

"undefined method validates_presence_of for model "

Is there some way I can perform those validations only when a user is
created?

This should work.

validates_numericality_of :value, :on => :create

On Dec 16, 3:26 pm, Christian J.

validates_presence_of :password_confirmation, :password, :on => :create