/ / एक नए नियंत्रक के भीतर spree_application लेआउट का उपयोग करें - रूबी-ऑन-रेल, रूबी, होड़

एक नए नियंत्रक के भीतर 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

लेकिन जब मैं शॉट्स_पथ पर जाने की कोशिश कर रहा हूं मुझे "एक त्रुटि मिली:

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 № 1

ठीक है कि कैसे पता करें:

स्प्री :: कोर :: कंट्रोलर हेल्पर्स :: एप्लीकेशन_कंट्रोलर.आरबी फ़ाइल में ऑर्डर शामिल करें


जवाब के लिए 0 № 2

यदि आप चाहते हैं कि आपका नियंत्रक स्प्री कोर का एक हिस्सा हो, तो उसकी फ़ाइल को स्थानांतरित करने का प्रयास करें 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