# Validate\_format\_of

**URL:** <https://www.ruby-forum.com/t/validate-format-of/114518>\
**Category:** Rails\
**Created:** [September 13, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/validate-format-of/114518 "2007-09-13T21:03:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [September 13, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/validate-format-of/114518/1 "2007-09-13T21:03:10Z")

</div>

I have the following code:

validates\_format\_of :password, :with =\> /^\w+$/, :message =\> ‘ **Password must be alphanumeric** ’, :on =\> :save

In order to get that message to display itself, do I have to say  
“object.save!” or will “object.save” also require that I validate the  
password. The reason I ask, is that I am doing some updating on a “User”  
object and instead of notifiying me when that there is a problem, the  
action simply does nothing and I am left wondering why the database  
wasn’t updated. Thanks for your help,

-S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/validate-format-of/114518/2 "2007-09-17T13:23:38Z")

</div>

Are you checking the return code of save?
