Path method displayed with rake routes is still undefined

有些话、适合烂在心里 提交于 2019-12-12 05:15:08

问题


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

来源:https://stackoverflow.com/questions/14674546/path-method-displayed-with-rake-routes-is-still-undefined

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