需要哪些基本设置才能确保路由 url 名称助手工作?
例如,在我的 route ,我有以下内容:
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
我不断收到错误
undefined local variable or method `new_refinery_news_url'
所以我很确定在我配置我的应用程序的方式中缺少一些东西,谁的主要路由在 Gemfile 中添加的 RefineryCMS gem 中。
有什么想法吗?
最佳答案
不得不使用 main_app.new_refinery_news_url
反而。
关于ruby-on-rails - Rails 路由 url 名称助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8321331/