2013-04-22 55 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