Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 从Spree_前端访问帮助程序_Ruby_Helper_Spree - Fatal编程技术网

Ruby 从Spree_前端访问帮助程序

Ruby 从Spree_前端访问帮助程序,ruby,helper,spree,Ruby,Helper,Spree,我正在编写一个名为customize的引擎,它与Spree\u frontend一起使用。我试图做的是使用商店布局显示商店页面 我在我的引擎中创建了一个模型元素,它的控制器和它的一组视图,这是常规方法: 在@engine/app/controllers/customize/element\u controller.rb中: class Customize::ElementController < ApplicationController layout: Spree::Config.l

我正在编写一个名为
customize
的引擎,它与
Spree\u frontend
一起使用。我试图做的是使用商店布局显示商店页面

我在我的引擎中创建了一个模型
元素
,它的控制器和它的一组视图,这是常规方法: 在
@engine/app/controllers/customize/element\u controller.rb
中:

class Customize::ElementController < ApplicationController
  layout: Spree::Config.layout

  <my code>
end
class Customize::ElementController

当我运行应用程序时,我得到一个错误,因为我的引擎
customize
没有找到
spree\u frontend
中定义的帮助程序。我应该如何在我自己的引擎中声明这些助手?

Ryan Bigg善意地回答了我关于谷歌群组的问题,请参阅。我在此引述他的答覆:

通过使用“include”,您就包括了指定方法中的方法 将模块插入该控制器。BaseHelper中的方法将 因此,只能在控制器中使用,而不能作为辅助对象使用 视图中的方法

我相信你想做的是:

include Spree::Core::ControllerHelpers帮助程序Spree::BaseHelper

helper方法将使该模块中的方法在中可用 该线所在的控制器的视图

瑞安·比格 社区经理 Spree商业公司

非常感谢,瑞安