我正在尝试使用刚刚添加到spree应用程序中的控制器中的spree_application布局
class ShotsController < Spree::BaseController
layout 'spree_application'
def index
@shots = Shot.all
end
def show
@shot=Shot.find(params[:id])
end
end但是当我尝试访问shots_path时,我得到了一个错误:
NoMethodError in Shots#index
Showing /Users/me/.rvm/gems/ruby-1.9.3-p327/gems/spree_core- 1.3.2/app/views/spree/shared/_nav_bar.html.erb where line #14 raised:
undefined method `current_order' for #< ShotsController:0x007f9c6b746e40>有人能帮我吗?
发布于 2013-04-22 23:34:41
好的,只要弄清楚怎么做就行了:
在application_controller.rb文件中包含Spree::Core::ControllerHelpers::Order
发布于 2013-04-26 23:58:39
如果您希望您的控制器成为Spree内核的一部分,请尝试将其文件移动到app/controllers/spree/中,并按如下方式重写它:
module Spree
class ShotsController < ApplicationController
layout 'spree_application'
def index
@shots = Shot.all
end
def show
@shot=Shot.find(params[:id])
end
end
endhttps://stackoverflow.com/questions/16138117
复制相似问题