I need to offer custom reports but haven't been able to find an
existing package to help us.

How have other people solved this problem? I read old posts but
haven't found anything (Ruports isn't 1.9-compatible, which would bite
us later, and enterprisey tools aren't an option).

The queries are complicated, so I've added the lengthy SQL as heredocs
to models as private methods, and am using find_by_sql in public
methods in my Report class (living in app/models). However if I base
my model off ActiveRecord, I get "table doesn't exist" errors. I don't
need a reports table, so I'm doing without and calling find_by_sql
using one of the other model classes.

There's a ReportsController which calls the Report model class
methods.

It seems like I'm swimming against the current. What's the Rails-y way
to solve this problem? What I'm doing doesn't seem right.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Djangst at Jan 8, 2012 at 9:17 pm
    The other problem I have is find_by_sql is only returning a couple of
    columns from one table, when it's supposed to return many columns from
    several tables.

    I can't convert the query to AR because it consists of subqueries
    within subqueries.
    On Jan 8, 3:04 pm, djangst wrote:
    I need to offer custom reports but haven't been able to find an
    existing package to help us.
    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Djangst at Jan 8, 2012 at 9:40 pm
    I gave up on find_by_sql (it wasn't adding the attributes it seemed it
    should) and am using select_all:

    @posts = ActiveRecord::Base.connection.select_all(query_method)
    On Jan 8, 4:16 pm, djangst wrote:
    The other problem I have is find_by_sql is only returning a couple of
    columns from one table, when it's supposed to return many columns from
    several tables.
    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 8, '12 at 8:04p
activeJan 8, '12 at 9:40p
posts3
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Djangst: 3 posts

People

Translate

site design / logo © 2021 Grokbase