加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-17 02:53:25 所属栏目:百科 来源:网络整理
导读:确保路由URL名称助手工作需要哪些基本设置? 例如,在我的路线中,我有以下内容: Blog::Application.routes.draw do resources :news,:as = :news_items,:controller = :news_items,:only = [:show,:index] scope :module = "refinery" do scope(:path = 'ref
确保路由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,: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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读