Ich versuche, das Layout "spree_application" in einem Controller zu verwenden, den ich gerade zu meiner Spree-App hinzugefügt habe
class ShotsController < Spree::BaseController
layout "spree_application"
def index
@shots = Shot.all
end
def show
@shot=Shot.find(params[:id])
end
end
aber wenn ich versuche, zu shots_path zu gehen Ich habe einen Fehler bekommen:
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>
kann mir jemand helfen
Antworten:
0 für die Antwort № 1ok, finde heraus wie:
Nehmen Sie Spree :: Core :: ControllerHelpers :: Order in die Datei application_controller.rb auf
0 für die Antwort № 2
Wenn Sie möchten, dass Ihr Controller Teil des Spree-Kerns ist, verschieben Sie die Datei in app/controllers/spree/
und schreibe es wie folgt um:
module Spree
class ShotsController < ApplicationController
layout "spree_application"
def index
@shots = Shot.all
end
def show
@shot=Shot.find(params[:id])
end
end
end