I suspect this just doesn't work like I'm expecting it too, but if I use :allow_nil => TRUE, validation rules still complain if a form field is submitted empty (w/o using a presence_of rule).
So...
validates_format_of :first_name, :with => Is_human_name, :allow_nil => TRUE, :message => Is_not_human_name_msg
Will complain if the field is submitted as empty. Now, empty doesn't conform to the regex I am using, but I am expecting that :allow_nil will cause the validation to be ignored when the value is empty.
(A) So what's the point of allow_nil? Or am I using it incorrectly?
Ultimately what I am trying to do is have certain messages override the need for others.
If I have this:
validates_presence_of :first_name
validates_format_of :first_name, :with => Is_human_name, :allow_nil => TRUE, :message => Is_not_human_name_msg
And the field is submitted as empty, then the only error message I need to see is the one that says the field cannot be empty. I do not need to see the format_of error message.
(B) What's the typical strategy for accomplishing that?
-- gw (www.railsdev.ws)