Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails + Prawn: undefined method `table' for #<Prawn::Document:0x007fda2d594a98>:

Tags:

prawn

I'm using Rails 4 + prawn_rails + the latest version of prawn (v 1.1.0) and I noticed in the changelog here: https://github.com/prawnpdf/prawn/wiki/CHANGELOG that tables are now separated.

I followed the instructions to require "prawn/tables". I did this by adding a file in my lib directory:

lib/prawn.rb

require "prawn/tables"

I restarted my rails server and I still get the error:

NoMethodError - undefined method `table' for #<Prawn::Document:0x007fda2d594a98>:

How do I fix this?

like image 372
bigpotato Avatar asked Jun 27 '14 15:06

bigpotato


2 Answers

You should add these lines into your Gemfile.

gem 'prawn', '~> 1.2.1'
gem 'prawn-table', '~> 0.1.0'
like image 62
Paulo Tarud Avatar answered Nov 17 '22 12:11

Paulo Tarud


The line in the documentation is WRONG. add require 'prawn/table' to your .pdf.prawn file on the top and it will work.

like image 22
bigpotato Avatar answered Nov 17 '22 13:11

bigpotato