简体   繁体   English

_form.html.erb中未定义的方法'pluralizer'

[英]undefined method `pluralizer' in _form.html.erb

I'm new to rails so maybe I'm missing something here but I am getting the following error when trying to use pluralizer in my form. 我是Rails的新手,所以也许我在这里遗漏了一些东西,但是在尝试在表单中使用复数形式时出现以下错误。

   undefined method `pluralizer' for #<#<Class:0x00000002f76528>:0x000000054a5ec0>

Here is the section in the form 这是表格中的部分

  <h2><%= pluralizer(normal_hour.errors.count, "error") %> prohibited this normal_hour from being saved:</h2>
  <ul>
  <% normal_hour.errors.full_messages.each do |message| %>
    <li><%= message %></li>
  <% end %>
  </ul>

Do I need to do a include ActionView::Helpers::TextHelper somewhere? 我是否需要在某个地方包含include ActionView :: Helpers :: TextHelper?

The method is pluralize and not pluralizer . 该方法是pluralize而不是pluralizer
Read more about it here 在这里了解更多

Also, you do not need to include ActionView::Helpers::TextHelper unless you would like to use pluralize in a model. 另外,除非您想在模型中使用pluralize ,否则无需包括ActionView::Helpers::TextHelper Check this question 检查这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM