Semone
Semone

Reputation: 1

Why do I get "uninitialized constant" error in ruby ruport

I am trying to create a report using ruport but I am getting an error.

in '<top (required)>': uninitialized constant Ruport::Report (NameError) Did you mean? Ruport

I used the sample code from https://www.rubydoc.info/github/ruport/ruport-util/Ruport/Report

I have the above code in TestExeReport class
In my main class, I have this:
require_relative '../../spec/support/testExeReport'

I have the gems installed.

I tried looking for help with that error message but none solved my problem.

require "rubygems"  
require "ruport"  

class TestExeReport < Ruport::Report   

    renders_as_grouping(:style => :inline)    

    def renderable_data(format)  
        table = Table("foo.csv")  
        Grouping(table, :by => "username")  
    end  
end   

report = TestExeReport.new  
report.save_as("bar.pdf")  

I would like to see a "pdf" report of my "csv" file

Thanks in advance!

Semone.

Upvotes: 0

Views: 76

Answers (1)

Jay Dorsey
Jay Dorsey

Reputation: 3662

The docs you linked appear to be from ruport-utils, which is an addon/extension for ruport.

You can find similar examples in the repo but the latest commit is 11 years ago that indicate you need another line in your example, after adding ruport-util to your Gemfile or installing via gem install ruport-util

require 'ruport/util'

However, you're going to see a dependency error most likely (I did)

Upvotes: 1

Related Questions