5

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?

Joshua Muheim
  • 12,617
  • 9
  • 76
  • 152
  • 2
    http://stackoverflow.com/a/6179686/724036 looks like you should modify yml language file. – zishe Mar 29 '14 at 13:05

1 Answers1

9

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

activerecord:
  ...

  models:
    sheet:
      one: User
      other: Users

According to this

Community
  • 1
  • 1
zishe
  • 10,665
  • 12
  • 64
  • 103