2013-04-22 40 views
1

我试图使用spree_application布局的控制器,我刚刚加入到我的大礼包应用使用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> 

没有人可以帮助我吗?

回答

0

OK刚刚弄清楚如何:

包括施普雷::核心:: ControllerHelpers ::订单在application_controller.rb文件

0

如果你希望你的控制器是施普雷核心的一部分,尝试将其文件移动到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 
end