I've been playing with Ruport, and just wanted to run this past the
group to see if anyone else has come across it.
The Ruport Book [1] give this example when it's explaining about using
acts_as_reportable to interrogate active record objects:
>> puts Book.report_table(:all, :only => :title, :include => { :author => {
>> :only => :name } })
+----------------------------------------------------+
| title | author.name |
+----------------------------------------------------+
| Why's (Poignant) Guide to Ruby | _why |
| Flow My Tears, The Policeman Said | Philip K. Dick |
| Farenheit 451 | Ray Bradbury |
| Gravity's Rainbow | Thomas Pynchon |
+----------------------------------------------------+
I had an issue with it blowing up because it couldn't map the symbols
in "only", so I wrapped them in square-brackets, but my result looks
like this:
>> puts Book.report_table(:all, :only => [:title], :include => { :author => {
>> :only => [:name] } })
+----------------------------------------------------+
| name | title | author.name |
+----------------------------------------------------+
| | Why's (Poignant) Guide to Ruby | _why |
| | Flow My Tears, The Policeman Said | Philip K. Dick |
| | Farenheit 451 | Ray Bradbury |
| | Gravity's Rainbow | Thomas Pynchon |
+----------------------------------------------------+
Any idea why I might be getting the extra "name" column? (if I remove
the :include condition, both the name columns go from the results)
One horrid caveat... I'm working on this in a Rails 2.1.1 app... and
no, they won't upgrade .... :-/
[1] http://ruportbook.com/acts_as_reportable.html
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.