Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7995805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:31:45+00:00 2026-06-04T14:31:45+00:00

I am following the first example in this tutorial: http://ruportbook.com/printable_documents.html , but I’m getting

  • 0

I am following the first example in this tutorial: http://ruportbook.com/printable_documents.html, but I’m getting undefined method `each’ for “”:String all the time, I created a new file with this code:

class MultiTableController < Ruport::Controller    
  stage :multi_table_report    
  class PDF < Ruport::Formatter::PDF    
    renders :pdf, :for => MultiTableController    
    build :multi_table_report do
      data.each { |table| pad(10) { draw_table(table) } }
      render_pdf
    end    
  end    
end

Then, in an existing controller named workers_controller.rb I have the next action:

  def index_report
    t1 = Table(%w[a b c]) << [1,2,3] << [4,5,6]
    t2 = Table(%w[a b c]) << [7,8,9] << [10,11,12]
    pdf = MultiTableController.render_pdf(:data => [t1,t2])
  end

Then, I’m getting this error on my browser:

undefined method `each' for "1":String

I have tried many others examples and I get the same error.

Some help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:31:46+00:00Added an answer on June 4, 2026 at 2:31 pm

    eachwas a method of String in ruby 1.8 and it was removed in Ruby 1.9.

    The reason was Unicode, or better the new encoding possibilities of ruby 1.9.

    What should String #each do? Loop on each byte or each character? Ruby can’t decide it for you, so you have to use String#each_byte or String#each_char.

    In Ruby 1.8 it was no difference, a character was a byte.


    Edit:

    Just give a dirty hack a chance:

    class String
      alias :each :each_char
    end
    
    'aaaa'.each{|x| p x }
    

    But ruport seems to have other problems with Ruby 1.9 and there may be side effects.
    I wouldn’t recommend this hack in a bigger project, but maybe it works in small scripts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was following this example: http://developer.android.com/resources/tutorials/views/hello-autocomplete.html And I want to know how I can
I'm new to code igniter. I'm following the form validation tutorial found at: http://www.codeignitor.com/user_guide/libraries/validation.html
I'm following the example here: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html Everything works fine. The first time I click
I am following this tutorial as a first foray into bootloader/OS development for x86
I've been following along with this excellent asio tutorial , but have got confused
It is my first time using android fragment. I am following this tutorial to
Am following the tutorial here on creating a simple todo list app: http://www.mydroid.apnafundaz.com/2010/07/todolist-application-in-android-step-by-step-guide-with-screen-shots/ Have
Aloha, I've been following the guidelines here: http://developer.android.com/resources/tutorials/testing/helloandroid_test.html To create some simple test cases
Noob question here. I'm following this example/tutorial to try and isolate a problem I
Given the following example data: Users +--------------------------------------------------+ | ID | First Name | Last

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.