मैं निम्नलिखित का उपयोग करने के कोशिश कर रहा हूँ: क्यों यह हो रहा हैरेल redirect_to: वापस काम नहीं कर रहा
undefined method `back_url' for #<PaymentsController:0x007ff682c467a8>
:
class PaymentsController < ApplicationController
def addproduct
(session[:products] ||= []) << params[:item]
redirect_to :back
end
end
मैं इस अपवाद मिल गया? redirect_to :back
के बजाय
redirect_back(fallback_location: root_path)
क्या आपको कंसोल में 'ActionController :: RedirectBackError' मिलता है? –
कंसोल में मुझे अपवाद मिला है जिसे मैंने लिखा था। – Lechucico
@Lechucico: आप रेल का किस संस्करण का उपयोग कर रहे हैं? रेल 5 से, यह फ़ॉलबैक विकल्प के साथ 'redirect_back' है। – Surya