# Validation problem

**URL:** <https://www.ruby-forum.com/t/validation-problem/148854>\
**Category:** Rails\
**Created:** [September 17, 2008, 7:18pm UTC](https://www.ruby-forum.com/t/validation-problem/148854 "2008-09-17T19:18:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![staypufd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecd19e/32.png) [@staypufd](https://www.ruby-forum.com/u/staypufd)\
**Post date:** [September 17, 2008, 7:18pm UTC](https://www.ruby-forum.com/t/validation-problem/148854/1 "2008-09-17T19:18:27Z")

</div>

I’m having issues with the validation process. Some of it works fine and  
others don’t and I do not know why. in this case the last 3 validations  
below do not work at all. I’m I doing something wrong? this should be  
pretty straight forward, so I thought.

validates\_presence\_of :login, :email  
validates\_presence\_of :password, :if =\>  
:password\_required?  
validates\_presence\_of :password\_confirmation, :if =\>  
:password\_required?  
validates\_length\_of :password, :within =\> 4…40, :if =\>  
:password\_required?  
validates\_confirmation\_of :password, :if =\>  
:password\_required?  
validates\_length\_of :login, :within =\> 4…40  
validates\_length\_of :email, :within =\> 4…100  
validates\_uniqueness\_of :login, :email, :case\_sensitive =\> false

validates\_format\_of :email, :with =\>  
/^([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i  
validates\_format\_of :login, :with =\> /\w/i  
validates\_exclusion\_of :login, :in =\> %w{ sessions upload weborb  
signup corp random}
