Forum: Ruby on Rails complex sql query approach

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sean O'Hara (Guest)
on 2007-01-19 17:32
(Received via mailing list)
Hi All,

I have a question about what would be the best or the "rails" way to
generate a report from my web app that is basically a web store. I
wonder if
I should just come up with a complex sql query by hand (which would
probably
take a while to figure out since I don't know much beyond basic sql,
i.e.
haven't delved into joins yet). Or should I just use my rails models and
attributes and do all the calculations in ruby (I fear this could this
could
entail a significant database hit).

Here is my data structure.

Artists has_many Releases has_many Products has_many LineItems has_many
Orders.

I would like to generate a sales report that lists each artist with
their
associated releases and for each product associated with that release I
would like to list the number of copies sold and the total sales price.

Any opinions on the best way to approach this?

Thanks in advance,
Sean
Craig W. (Guest)
on 2007-09-26 00:40
(Received via mailing list)
On Thu, 2007-01-11 at 19:39 -0500, Sean O'Hara wrote:
>
> Any opinions on the best way to approach this?
----
the find (complex searches)...

http://brainspl.at/articles/2006/06/30/new-release...

the view code - start hacking

Craig
This topic is locked and can not be replied to.