需要什麼基本設置來確保路由URL名稱助手工作?Rails路由URL名稱助手
比如在我的路線,我有以下:
Blog::Application.routes.draw do
resources :news, :as => :news_items, :controller => :news_items, :only => [:show, :index]
scope :module => "refinery" do
scope(:path => 'refinery', :as => 'admin', :module => 'Admin') do
resources :news, :except => :show, :as => :news_items, :controller => :news_items
end
end
end
但以下似乎不工作:
new_refinery_news_url
我不斷收到錯誤
未定義的局部變量或方法`new_refinery_news_url'
所以我很確定在我配置我的應用程序的方式中缺少一些東西,誰的主要路由是在Gemfile中添加的RefineryCMS gem中。
有什麼想法?
這東西,所有路線的方法Rails的對象named_path '不工作。解決這個問題的唯一方法是直接使用'/煉油廠/新聞/新',例如 '<%= link_to t('。create'),'/ refinery/news/new',:class =>「add_icon 「%>' – mabounassif