# Common model validation probelm

**URL:** <https://www.ruby-forum.com/t/common-model-validation-probelm/159940>\
**Category:** Rails\
**Created:** [February 10, 2009, 6:46am UTC](https://www.ruby-forum.com/t/common-model-validation-probelm/159940 "2009-02-10T06:46:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [February 10, 2009, 6:46am UTC](https://www.ruby-forum.com/t/common-model-validation-probelm/159940/1 "2009-02-10T06:46:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [February 10, 2009, 9:57am UTC](https://www.ruby-forum.com/t/common-model-validation-probelm/159940/2 "2009-02-10T09:57:22Z")

</div>

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](mailto:removed_email_address@domain.invalid)
