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