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

bigpotato picture bigpotato · Jun 27, 2014 · Viewed 8.6k times · Source

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?

Answer

Paulo Tarud picture Paulo Tarud · Aug 21, 2014

You should add these lines into your Gemfile.

gem 'prawn', '~> 1.2.1'
gem 'prawn-table', '~> 0.1.0'