Ruby on Rails Inflection Issue

筅森魡賤 提交于 2019-12-01 18:46:29

Have you tried adding a line for the inverse inflection (i.e. 'singular'):

 inflect.singular "starbases", "starbase"

I tried your example in my console and it was the singularization that caused problems, not the other way around. I'm not sure if this fixes other issues (like routes), but it should fix the simple stuff (I think).

Little trick i picked up to double check how Active Support might singularize, or pluralize my Class names, and/or Module names.

have your rails app server running and in a new tab enter into your rails console by typing rails console. In there you can easily double check for the correct style for your names.

long way ActiveSupport::Inflector.pluralize "fish" # => "fish"

short way "fish".pluralize # => "fish"

You can find more examples here

https://github.com/rails/rails/blob/master/activesupport/test/inflector_test_cases.rb

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