Display form errors in rails 3.x

<% if @object.errors.any? %> <div id="errorExplanation"> <h2><%= pluralize(@object.errors.count, "error") %> prohibited this object from being saved:</h2> <ul> <% @object.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %>
Display object errors from ActiveRecord form validation on view.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.