class User < ActiveRecord::Base
validates_presence_of :password, :if new_record?
attr_accessor :update_password
def new_record?
 update_password
end
控制器里面这样写
@user.update_password=false //不验证
@user.update_password=true //验证