ruby-on-rails - Rails 路由 url 名称助手

标签 ruby-on-rails routing refinerycms

需要哪些基本设置才能确保路由 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/

相关文章:

ruby-on-rails - 测试后删除临时文件

ruby-on-rails - 从 Rails 模型中访问 c​​urrent_user?

html - ui-router 在访问页面时在我的 ui-views 中显示原始代码

ruby-on-rails - Refinery CMS 中的多个布局

ruby-on-rails - helper 和包含在 Controller 中的区别是什么?

mysql - 如何使用 ruby​​ 将其他语言存储在 mysql 数据库中?

ruby-on-rails - rails_admin gem 中的自定义操作

c# - 从 MVC 4 中的 URL 获取 "Id"值

ruby-on-rails - 如何最容易地通过路由助手转发参数?