Path method displayed with rake routes is still un

2019-09-06 08:41发布

问题:

After getting rid of this question, I get one another.

I have a path method specified in routes resources :tree_nurseries do .... And shows correctly when I do rake routes which gives new_tree_nursery then normally new_tree_nursery_path will be available.

But, when I call it with a link_to method, it remains undefiend.... (new_tree_nursery_path)

What did I missed again?

this is the code line :

.actions
  = link_to t('.new', :default => t("helpers.links.new")), new_tree_nursery_path, :class => 'btn btn-primary pull-right'

And the rake routes result :

               tree_nurseries GET    /tree_nurseries(.:format)                     tree_nurseries#index
                          POST   /tree_nurseries(.:format)                     tree_nurseries#create
         new_tree_nursery GET    /tree_nurseries/new(.:format)                 tree_nurseries#new
        edit_tree_nursery GET    /tree_nurseries/:id/edit(.:format)            tree_nurseries#edit
             tree_nursery GET    /tree_nurseries/:id(.:format)                 tree_nurseries#show
                          PUT    /tree_nurseries/:id(.:format)                 tree_nurseries#update
                          DELETE /tree_nurseries/:id(.:format)                 tree_nurseries#destroy

config/environment.rb :

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'tree_nursery', 'tree_nurseries'
end