I have validates_format_of :name, :with => *my regex*, :message => "That''s wrong" The validation works but the message does not get displayed when the user enters invalid data. Does anyone have any ideas how to fix it? Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gtOY6VIxVhIJ. For more options, visit https://groups.google.com/groups/opt_out.
On 9 August 2012 17:06, tomkins <j.tomkins-EMRzualFZlQ@public.gmane.org> wrote:> I have validates_format_of :name, :with => *my regex*, :message => "That''s wrong" > The validation works but the message does not get displayed when the user enters invalid data. > Does anyone have any ideas how to fix it?What have you got in the view to show the messages? Do you get any message at all? Do other validations generate messages (default or custom)? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
You can test it in the console rails c p=YourModel.new p.valid? p.errors On Thursday, August 9, 2012 12:06:36 PM UTC-4, tomkins wrote:> > I have validates_format_of :name, :with => *my regex*, :message => "That''s > wrong" > The validation works but the message does not get displayed when the user > enters invalid data. > Does anyone have any ideas how to fix it? > > Thanks. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_yfrd7xBHK8J. For more options, visit https://groups.google.com/groups/opt_out.