-->

Rails can't map automatically “y” ending plura

2019-07-20 18:53发布

问题:

In my rails app, I added the model TreeNursery, then added in routes.rb resources :tree_nurseries do....

The first problem that I've got is that when I added has_many :tree_nurseries to the Village model, rails couldn't map it before I added :class_name => 'TreeNursery'.

After that, when I do rake routes I get tree_nurseries_index which is very weird for me.

Is there any clue for this ?

回答1:

You can specify your own custom inflector. This should help guide you along: How do I override rails naming conventions?