Connecting Tech Pros Worldwide Forums | Help | Site Map

Ruby Reports

Newbie
 
Join Date: Oct 2007
Posts: 19
#1: Jun 28 '08
Hello,
I am referring the link below for creating the ruby reports.For creation of report_table, query is used for selecting only particular table.If i query the report_table, am getting error as "undefined method slice! for Hash".

Ex:
1. Author.report_table(:all, :only => ['id','name'])
If i use like this.I am getting error.
2. Author.report_table
If i use like this,its working properly.

I want to select only particular column from table.Please help me to do this.Its urgent.Thanks




http://www.oreillynet.com/pub/a/ruby/2008/04/08/ruport-business-reporting-for-ruby.html?page=1

Expert
 
Join Date: May 2007
Posts: 213
#2: Jun 30 '08

re: Ruby Reports


I know this isn't what the tutorial says, but you could try
Expand|Select|Wrap|Line Numbers
  1. Author.report_table(:all, :only => 'id, name')
At least, that is how the Active Record :select seems to work.
Newbie
 
Join Date: Oct 2007
Posts: 19
#3: Jul 2 '08

re: Ruby Reports


Quote:

Originally Posted by improvcornartist

I know this isn't what the tutorial says, but you could try

Expand|Select|Wrap|Line Numbers
  1. Author.report_table(:all, :only => 'id, name')
At least, that is how the Active Record :select seems to work.


Thanks for the reply. Even that is not working for me.
We can also use Author.report_table_by_sql("select .....")
Expert
 
Join Date: May 2007
Posts: 213
#4: Jul 2 '08

re: Ruby Reports


It stinks when tutorials don't work the same way they tell you to do something. I'm not sure what you can do in this case. It may be best just to use Author.report_table_by_sql("select .....").
Reply


Similar Ruby / Ruby on Rails bytes