Rails can't map automatically “y” ending plura

2019-07-20 18:50发布

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条回答
不美不萌又怎样
2楼-- · 2019-07-20 19:30

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

查看更多
登录 后发表回答