I implemented the validates_presence_of field for the comments in the guide. How to display validation errors on the post page. I know the rendering, but with the rendering I need to send all the variables I use on the post page . Am I right?
I don’t believe that plugins are necessary. The scaffolding generator in Rails 3.x does this:
<%= form_for(@model) do |f| %>
<% if @model.errors.any? %>
< div id="error_explanation">
<%= pluralize(@model.errors.count, "error") %> prohibited this model from being saved:
- <%= msg %>
<% @model.errors.full_messages.each do |msg| %>
<% end %>
<% end %>
<%# Rest of form... %>