hi, Based on the validation done in a model, how can I show errors in a custom manner , eg. instead of showing like : 2 errors prohibited this textbrand from being saved There were problems with the following fields: * Textbrand already exists * Textbrand approved is not numeric. By using in view : <%= error_messages_for ''textbrand'' %> How can I show messages like : There were problems with the following fields: * Textbrand * Textbrand approved And in the form next to the textbrand , I want to show ''already exists''. and next to approve text field, I want to show '' is not numeric''. Any help is greatly appreciated. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sheldon Hearn
2007-Feb-13 08:49 UTC
Re: how to show model validation error in a custom view
You can''t achieve what you want with error_messages_for. You''ll have to build up your own error display using error_messages_on (note on instead of for). You''d think this would be a perfect opportunity to use a custom form builder, but take care: http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/13028ae842da2d6b/8510ccd7ef5cd1ac I asked that question over a month ago and still haven''t had a reply, so you may find yourself on your own if you try the custom form builder approach. Neither AWDWR nor Rails Recipes deal with this. Ciao, Sheldon. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---