Custom Inflections not working on rails3?

偶尔善良 提交于 2019-12-22 07:52:28

问题


I'm using Rails (3.0.1) and have the following code in initializers/inflections.rb

ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular('nursery', 'nurseries')
end

From the console I'm getting:

"nursery".pluralize => "nurseries"
"nurseries".singularize => "nurseries"

I should be getting:

"nurseries".singularize => "nursery"

Any ideas?

来源:https://stackoverflow.com/questions/4028992/custom-inflections-not-working-on-rails3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!