Question

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?

Was it helpful?

Solution

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

activerecord:
  ...

  models:
    sheet:
      one: User
      other: Users

According to this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top