炼油无法调用自己的控制器路由,操作



首先我创建了refinerycms应用程序,在我的应用程序中,我无法调用我自己的控制器路由、操作和视图,我出现了类似的错误

undefined local variable or method `contacts_save_contact_path' for #<#<Class:0xafc9338>:0xb5467fc>

我发现自己不得不将refinery.route_path与精炼厂url助手放在一起,所以在您的情况下,refinery.contacts_save_contact_path可能会完成

您必须访问实际应用程序的url_helper,这取决于应用程序的命名空间。例如:

在config/routes.rb:中

MyApp::Application.routes.draw do
  resources :foos
  mount Refinery::Core::Engine, at => '/'
end

rake routes显示:

    foos GET /foos(.:format) foos#index
refinery     /               Refinery::Core::Engine

你应该能够使用:

MyApp::Application.routes.url_helpers.foos_path

路径必须是这样的人:Refinery::Core::Engine.routes.url_helpers.your_object_admin_your_object_path

main_app.contacts_save_contact_path应该可以工作。

最新更新