Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从 Rail 3 开始,我习惯这样做:
User.model_name.human count: 2 # "Users"
这似乎在 Rails 4 中不起作用?
[1] base » User.model_name.human count: 2 => "User"
虽然复数一个简单的字符串似乎有效:
[2] base » "User".pluralize => "Users"
知道这里有什么问题吗?
这要求您已修改您的语言 *.yml :
activerecord: ... models: sheet: one: User other: Users
根据这个