Experimental AAR Features

0 views
Skip to first unread message

Michael Milner

unread,
Feb 28, 2007, 9:34:28 PM2/28/07
to ruby-r...@googlegroups.com
I made a new branch of AAR (called aar_views) with some changes I've been experimenting with.  This is in a very early stage of development and doesn't do much right now, but I wanted to get it out there with the hope that I can get some opinions on the approach and ideas on where we might take AAR from here.  So please give it a try and let me know what you think.  The toughest thing right now is deciding exactly how Ruport should be integrated with Rails, so any ideas are welcome ( i.e. how would you like to be able to use Ruport with Rails).

Basically, the version of AAR in this branch allows you to use a new template type in Rails - with an extension of .report.  You set up your data in a controller - use report_table to generate a Data::Table.  So your controller might have a method like:

  def test
    @books = Book.report_table(:all, :except => 'id', :include => :author)
  end

Then you'd have a view file like this (in app/views/books/test.report):

  <%= header "Report Header", :font => 'arial', :font_size => '2em' %>
  <%= detail @books %>
  <%= footer Date.today.to_s, :align => 'center' %>

Right now, those are the only three helpers defined, it uses a standard renderer, and only generates HTML.  So future plans would be to add other helpers, allow other formats to be rendered, and to allow you to define your own renderer.

Note that you need to be running the most recent trunk version of Ruport for this to work since I used some of the new formatting features.

Any comments and ideas will be appreciated.

Mike
Reply all
Reply to author
Forward
0 new messages