Connecting Tech Pros Worldwide Help | Site Map

Ruby Reports

  #1  
Old June 28th, 2008, 04:43 AM
Newbie
 
Join Date: Oct 2007
Posts: 19
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
  #2  
Old June 30th, 2008, 03:38 PM
Expert
 
Join Date: May 2007
Posts: 213

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.
  #3  
Old July 2nd, 2008, 02:19 PM
Newbie
 
Join Date: Oct 2007
Posts: 19

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 .....")
  #4  
Old July 2nd, 2008, 03:12 PM
Expert
 
Join Date: May 2007
Posts: 213

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 Threads
Thread Thread Starter Forum Replies Last Post
Ruby Reports(CSV) divyakgowda answers 1 July 28th, 2008 04:51 PM
Pagination in Ruby on Rails divyakgowda answers 2 July 8th, 2008 04:08 PM
Generating reports from database Batista, Facundo answers 2 July 18th, 2005 09:45 AM
What's better about Ruby than Python? Brandon J. Van Every answers 220 July 18th, 2005 03:04 AM