Search code examples
ruby-on-railsinternationalizationpluralize

Rails 4: pluralizing model_name.human using count: 123 doesn't work


From Rail 3, I'm used to do this:

User.model_name.human count: 2 # "Users"

This doesn't seem to work in Rails 4?

[1] base »  User.model_name.human count: 2
=> "User"

While pluralizing a simple string seems to work:

[2] base »  "User".pluralize
=> "Users"

Any idea what's the problem here?


Solution

  • This requires that you have modified your language *.yml as such:

    activerecord:
      ...
    
      models:
        sheet:
          one: User
          other: Users
    

    According to this