Multiple tables query

HI, I’ve read the basic books about ROR and even skimmed the recipes
book but can’t find a standard path for my problem.
I’ve to show data that due to relationships is going to take more
tables, not one or two but 6/7 and even 13 in some cases. Now in other
languages I usually write a quite long SQL statement and I get what I
want. But with Rails? Should I work on the model? Should I create a view
and then a class associated with it? Should I write the same old SQL
statement?

Thank you very much.

Nik

On 10/8/07, Nik N. [email protected] wrote:

HI, I’ve read the basic books about ROR and even skimmed the recipes
book but can’t find a standard path for my problem.
I’ve to show data that due to relationships is going to take more
tables, not one or two but 6/7 and even 13 in some cases. Now in other
languages I usually write a quite long SQL statement and I get what I
want. But with Rails? Should I work on the model? Should I create a view
and then a class associated with it? Should I write the same old SQL
statement?

Well you could try modelling the relationships in ActiveRecord, but I
don’t fully know how far Model.find … goes in recursing those
relationships.
Ideally you want it all to come back in the one query.

Still if you have that kind of SQL, I think using the raw SQL query is
the
best choice. Rails allows you to do this, and even encourages you to
do this when you outgrow what Rails gives you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs