【问题标题】:Refinerycms can't call my own controller route,actionsRefinerycms 无法调用我自己的控制器路由,操作
【发布时间】:2012-08-25 07:23:38
【问题描述】:

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

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

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 refinerycms


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      您必须获得对实际应用程序的 url_helpers 的访问权限,这取决于应用程序的命名空间。例如:

      在 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

      【讨论】:

        【解决方案3】:

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

        【讨论】:

          【解决方案4】:

          main_app.contacts_save_contact_path 应该可以工作。

          【讨论】:

            猜你喜欢
            • 2011-12-03
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2012-06-19
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多