Ruby-on-rails – Error message in Ruby on Rails

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:




    <% @model.errors.full_messages.each do |msg| %>
  • <%= msg %>

  • <% end %>


<% end %>
<%# Rest of form... %>

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 there is 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? %>

< h2><%= pluralize(@model.errors.count, "error") %> prohibited this model from being saved:


    <% @model .errors.full_messages.each do |msg| %>
  • <%= msg %>

  • <% end %>


<% end %>
<%# Rest of form... %>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3307 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.