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 :slight_smile:

Thanks!

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