Forum: Ruby on Rails Common model validation probelm

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-02-10 06:46
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.
1a8688b1d13c493617312672facbbf74?d=identicon&s=25 zerogy (Guest)
on 2009-02-10 09:57
(Received via mailing list)
Hello, is it because of :on => :create? maybe you could change it to
default

On Feb 10, 1:46 pm, Dharmdip Rathod <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.