Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Empty table causes error "Ruport::FormatterError: Can't output table without data or column names." #2

Open
zackxu1 opened this issue May 8, 2013 · 0 comments

Comments

@zackxu1
Copy link

zackxu1 commented May 8, 2013

Hello.

I have the following code:

table = Order.report_table(:all, :conditions => "aasm_state = 'paid'")

In my database, the "orders" table has no record with aasm_state of "paid".
I thought it should just return an empty table, with size 0.
But I'm getting

Ruport::FormatterError: Can't output table without data or column names.

How do I avoid this error?

In practice, it's possible that a table is empty. It would be ugly if I have to check
for this condition before calling Order.report_table(...)

Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant