All, I have been going through the tutorial at here:
I ran into an issue with the code snippet below.
<%= form_for :article, url: articles_path do |f| %>
``<% if @article.errors.any? %>
``<div id="error_explanation">
``<h2>
``<%= pluralize(@article.errors.count, "error") %> prohibited
``this article from being saved:
``</h2>
``<ul>
``<% @article.errors.full_messages.each do |msg| %>
``<li><%= msg %></li>
``<% end %>
``</ul>
``</div>
``<% end %>
However, when I replace it with the pluralize method invocation without () as seen below, it works just fine. Any ideas what I have been doing wrong? (apologies for the awful formatting. Copy/Paste wasn’t friendly!)
<%= form_for :article, url: article_path(@article) method: :patch do |f| %>
<% if @article.errors.any? %>
<h2>
<%= pluralize @article.errors.count,‘error’ %>
prohibited
this article from being saved: </h2>
<ul>
<% @article.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<% end %>
</ul>
<%end%>
Thanks for reading and commenting
Chris