我正在尝试使用 Spree::Core 引擎中定义的 current_order 方法:https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rb https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rb
在我看来,我已经尝试过
Spree::Core::CurrentOrder.current_order
在开发中仅使用“current_order”效果很好,但在生产中则不然。
然后我尝试在我的视图文件中要求它,如下所示:
require 'spree/core/current_order'
我还尝试了这些其他解决方案的排列:
如何在主应用程序中合并 Rails Engine ApplicationController 方法? https://stackoverflow.com/questions/11124447/how-to-incorporate-rails-engine-applicationcontroller-methods-in-a-main-app
将 before_filter 从引擎添加到应用程序的方法 https://stackoverflow.com/questions/7323327/a-way-to-add-before-filter-from-engine-to-application/
Rails 3.1:在客户端应用程序中公开引擎助手的更好方法 https://stackoverflow.com/questions/8797690/rails-3-1-better-way-to-expose-an-engines-helper-within-the-client-app
但我已经忘记了我实际上做了什么。
有人可以指出我正确的方向吗?也许我错误地实施了上述链接中的解决方案?
这是我在生产中遇到的错误:
2012-06-21T09:59:08+00:00 app[web.1]: ActionView::Template::Error (Spree::Core::CurrentOrder:Module 的未定义方法“current_order”):
如果我用 current_order 注释掉代码行,则一切都可以在生产中运行。
我在想这就是生产中加载东西的方式吗?但这是我第一次尝试部署,所以我不太了解开发和生产之间的差异。
提前致谢!