摆脱这个问题后,我得到了另一个。
我在 routes 中指定了一个路径方法resources :tree_nurseries do ...
。并在我这样做时正确显示rake routes
,new_tree_nursery
然后通常new_tree_nursery_path
会可用。
但是,当我使用 link_to 方法调用它时,它仍然是 undefiend.... ( new_tree_nursery_path
)
我又错过了什么?
这是代码行:
.actions
= link_to t('.new', :default => t("helpers.links.new")), new_tree_nursery_path, :class => 'btn btn-primary pull-right'
和耙路线的结果:
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
配置/环境.rb:
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'tree_nursery', 'tree_nurseries'
end