Prawn 0.11.1 doesn't work with rails 3.0.9
I have a Rails 3 app, and I'm using Prawn to generate PDF files.
I have defined this in my controller:
Class DocumentosController < ApplicationController
def show
@documento = Documento.find(params[:id])
prawnto :prawn => {
:left_margin => 20,
:right_margin => 20
}
end
end
In my view I have this:
<p><%= link_to "Download", documento_path(@docmento, :format => "pdf") %></p>
In application.rb I have this:
config.gem "prawn"
And I get:
NoMethodError in DocumentosController#show
undefined method 'prawnto' for #<DocumentosController:0xb6e99358>
I try to reinstall the gem, but the problem continuem, and if I try /documentos/6.pdf e.g. the gem generate the PDF but there is an error with the file.
Any idea, which i开发者_如何学Cs the problem?
Thanks for your help.
Rails 3 uses bundler in order to require gems. So you have to add prawn to your Gemfile and then run bundle install
精彩评论