मैं एक prawn
वर्ग के अंदर rails 3.2
सहायकों उपयोग करने के लिए कोशिश कर रहा हूँ, लेकिन रेल फेंकता है:रेल/प्रोन: मैं प्रोन क्लास के अंदर रेल सहायकों का उपयोग कैसे करूं?
undefined method `number_with_precision' for #<QuotePdf:0x83d4188>
झींगा कक्षा
class QuotePdf < Prawn::Document
def initialize(quote)
super()
text "sum: #{number_with_precision(quote.sum)}"
end
end
नियंत्रक
def show
@quote = current_user.company.quotes.where(:id => params[:id]).first
head :unauthorized and return unless @quote
respond_with @quote, :layout => !params[:_pjax] do |format|
format.pdf do
send_data QuotePdf.new(@quote).render, filename: "Devis-#{@quote.date_emission.strftime("%d/%m/%Y")}.pdf",
type: "application/pdf"
end
end
end
आपकी मदद के लिए धन्यवाद।
रेल 3.2.11 में मेरे लिए अच्छी तरह से काम किया। Siekfried नहीं किया था। धन्यवाद! –
नवीनतम रेल संस्करण पर वर्ग (कक्षा की परिभाषा से पहले) के बाहर होना चाहिए !! – mArtinko5MB