Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>i've worked on a few projects that need reporting. the web application stack isn't the best place to do your reporting, but it seems that the open source reporting options are fairly limited. but not every organization can use SSRS or Crystal and in my experience those products are painful and introduce more problems than necessary.</p> <p>I'm using views to get these done. SQL is designed for grouping and aggregating data and it's more equipped to handle this stuff than ruby. however, most of the time, views are going to be executed on the fly, so it's not like you're getting a performance gain here. ideally, after you get a basic implementation, you can set up some cron tasks or means of precalculating the data. and if your reports are going to be accessed often and during the day, you will want a dedicated reporting db. if the reports have to have live data, you will need to set up replication.</p> <p>messing with SQL within Ruby/Rails is messy and frowned upon, I know. So I wrote a gem called Skiima and it helps you manage extraneous SQL objects that you may have in your project. And by loading them with your migrations, it becomes easier to test these.</p> <p><a href="http://github.com/dcunited001/skiima" rel="nofollow">http://github.com/dcunited001/skiima</a></p> <p>aside from that, this is what i've been doing:</p> <pre><code>class AccountsReport &lt; ActiveModel attr_accessor :items def initialize(attr = {}) # read in params, set attrs end def execute get_report_items group_report_items summarize_report_groups # if this needs to occur outside of sql end end class AccoutsReportItem &lt; ActiveRecord::Base # you can hook into a view here, you will want the view to return an id col set_table_name :view_accounts_report_items end # yay for arel and activerecord methods. # you can even set up relationships on these. use sparingly. # AccountsReportItem.where(:blah =&gt; 'balah') </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload