gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:28:45 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com