<% @articles.each do |article| %>
<td align="center"><%= article.comments_count %></td>
<% end %>
undefined method `comments_count' for #<Article:0x007fb51fb001b8>
Did you mean? comments
There are also some optional column names that will add additional features to Active Record instances
It means that if you add columns (using migration) that have names following the naming conventions, you’ll get that feature.
<relationship_name>_count convention is used for
counter_cache option of
belongs_to, which you can read about more here: http://guides.rubyonrails.org/association_basics.html#options-for-belongs-to
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Documentation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/rubyonrails-docs.
For more options, visit https://groups.google.com/d/optout.