Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 639
Joshua Muheim Avatar asked Mar 29 '14 11:03

Joshua Muheim


Video Answer


1 Answers

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

activerecord:
  ...

  models:
    sheet:
      one: User
      other: Users

According to this

like image 128
zishe Avatar answered Oct 19 '22 00:10

zishe