Common model validation probelm


#1

Hello ,

I am facing strange problem here. I have model customer.rb , i am
validating following fields

validates_presence_of :email
validates_format_of :email, :with =>
/(^([^@\s]+)@((?:[-_a-z0-9]+.)+[a-z]{2,})$)|(^$)/i
validates_uniqueness_of :email
validates_presence_of :password, :on => :create
validates_length_of :password, :in => 4…20, :allow_nil => false,:on
=> :create
validates_presence_of:password_confirmation, :if =>
:password_required?
validates_confirmation_of :password, :if => :password_required?
validates_presence_of :first_name
validates_presence_of :last_name
validates_presence_of :address
validates_presence_of :country_id
validates_presence_of :state_id
validates_presence_of :city
validates_numericality_of :zip
validates_presence_of :phone
validates_presence_of :securityque_id
validates_presence_of :answer
validates_acceptance_of :policy

after submitting form successfully , i am giving update facility for
updatepassword, and edit profile when i am updating profile it ask for
password field and when i am updating password it ask for nothing .
is there any way ???
thank in advance.


#2

Hello, is it because of :on => :create? maybe you could change it to
default

On Feb 10, 1:46 pm, Dharmdip R. removed_email_address@domain.invalid