Ruby on Rails Wednesday, December 1, 2010


2010/12/1 Venkat Surabhi <lists@ruby-forum.com>
require 'prawn'
require 'prawn/core'
require 'prawn/layout'

Prawn::Document.new do |pdf|
   subtable = pdf.make_table([[ "foo", "bar" ], [ "baz", "bax" ]],
                             :column_widths => [ 50, 50 ]) {
       column(0).background_color = "808080"
       cells.borders = []
   }

   table = pdf.make_table([[ "foo", "bar" ], [ "baz", subtable ]],
                             :column_widths => [ 100, 100  ]) {
       cells.border_width = 5
   }
   table.draw
end

When i execute the above code i am getting below mentioned error:


e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/graphics/color.rb:72:i
n `method_missing': undefined method `make_table' for
#<Prawn::Document:0x2e4b95
0> (NoMethodError)
       from border.rb:6
       from
e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document.
rb:238:in `[]'
       from
e:/ruby/lib/ruby/gems/1.8/gems/prawn-core-0.8.4/lib/prawn/document.
rb:238:in `initialize'
       from border.rb:5:in `new'
       from border.rb:5


In apis it is mentioned that Prawn::Document object has method
make_table.
 
I notice you are using prawn 0.8.4. This method make_table  does not exist in prawn 0.8.4. You need to upgrade to something like prawn 0.10.2 and higher. If you have more prawn related questions, there also exists a prawn forum: prawn-ruby[AT]googlegroups[DOT]com, which can help you more.

Thanks,

---
Edmond
Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi

Cell:  +265 999 465 137 | +265 881 234 717

"Leading the Improvement of Health through Information and Communication Technology in the Developing World" The Creed of Baobab Health

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment