nahabed
2008-Jul-08 05:45 UTC
Looking for a framework to report user feedback and form errors
We''re building our first Rails app and looking for a consistent way to provide feedback messages; things like success messages like "your password changed successfully" or form errors with the form field highlighted in red (you know). I''ve read that Rails provides a framework for this but we''ve diverged in how we do this in our app and would to reign things in :) 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-/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 -~----------~----~----~----~------~----~------~--~---
Rails Terrorist
2008-Jul-08 06:13 UTC
Re: Looking for a framework to report user feedback and form errors
nahabed wrote:> We''re building our first Rails app and looking for a consistent way to > provide feedback messages; things like success messages like "your > password changed successfully" or form errors with the form field > highlighted in red (you know). >Welcome in Rails and Ruby. For your question, ruby on rails handles all error messages depending to your wanted. Example : you want form errors with highlighted messages, rails handles it in model, you can see validates function with :messages => "...." or def validate ... errors.add(:attribute, "cant be bla..bla..bla") end But if you want show notificatin after input data like "your password changed successfully", you can use flash[:notice] in your view just call : <% if flash[:notice] -%> <%= flash[:notice] %> <% end %> for hightlighted error messages, in your view is just calling : <%= error_messages_for ''model_name_1'', ''mode_name_2'' %> i hope my description can help your problem, good luck. reinhart http://teapoci.blogspot.com -- 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 -~----------~----~----~----~------~----~------~--~---