skip validation

:on => create


This does not sound right to me.

WHen you save a user object you should either have a password or not
have one. If you allow the user to exist with no password then your
validations should be done conditionally in your validate method.
But, I would not allow a user to exist without a password, that is a
bad security setup. Validations happen at the model level not the
form level, so you are validating the entire user record not just the
fields being changed by a form.

If I misunderstood your situation pleas include more detail.


First a more direct answer to your question:

ActiveRecord supplies validate_on_create and validate_on_update as
separate methods from validate. If you really wanted validation of
creation of objects, but not on update you could put your validation
in validate_on_create.

However, it sounds like you have a fundamental misunderstanding of
validation (as eluded to in a previous reply). If you are validating
a user's password for presence and length then you should always
perform that check.

class User < ActiveRecord::Base
  validates_presence_of :username, :password
  validates_length_of :password, :minimum => 6

    #put your create validations here

    #put your update validations here

It almost sounds like you are validating somewhere else besides the
model. If you are doing that then....well don't. What happens if
records are inserted or updated without going through your view or

from what i have understood:
firstly u need to get a instance of the user you want to update
@user = users.find( :first, :conditions => { :id => your id} )
now update the instance and call update on this instance
the validations are already in the right place so no need to change