Am Freitag, den 27.01.2006, 18:11 -0500 schrieb Francois Beausoleil: > 2006/1/27, Norman Timmler <[EMAIL PROTECTED]>: > > validates_presence_of :email_address, :message => 'Give me an address!' > > validates_format_of :email_address, :with => /[EMAIL PROTECTED],}/, > > :message => 'Something's wrong with your address!' > > In this specific case, couldn't you replace the regexp and leave of > the validates_presence_of ? > > validates_format_of :email_address, :with => /[EMAIL PROTECTED],}\Z/, > :message => 'Something's wrong with your address, > or it\'s missing!' > > Notice I added anchor points to the regexp. I do realize that this > doesn't solve all cases, though.
This was more an example than a real world usage. Also the regular expression is not the one i usually use. Maybe it is a kind of philosophy, but is like concrete error messages for my clients and even like them if i have to complete a form. I am not a fan of 'Something is wrong here, but i don't tell you what.' The block syntax could help you to throw easy to understand and very specific error messages. -- Norman Timmler http://blog.inlet-media.de _______________________________________________ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
