I may be wrong but as far as I know you just gotta keep cascading down
that way.
But DO keep in mind to make only those associations that are
absolutely necessary. For eg., if you're gonna display all countries
in a planet only at one place, and if you are not gonna build logic
around the planet has_many countries, through continents association,
then you could still get all countries in a planet by doing
planet.continents.countries without has_many :countries, :through
=> :continents.
Then again, Im not sure if you save anything by doing that.

On May 10, 3:40 am, Andrei Teodorescu <rails-mailing-l...@andreas-
s.net> wrote:
> Hi guys,
> I have this issue on RoR associations: have a 'has many' relationship
> cascade, on many levels. I need to display data across multiple tables,
> sort like a 'sql table view'. I could accomplish this only up to a
> second level association, like in the below example.
>
> class Planet < ActiveRecord::Base
>   has_many :continents
>   has_many :countries, :through => :continents
> end
>
> class Continents < ActiveRecord::Base
>   belongs_to :planet
>   has_many :countries
> end
>
> class Country < ActiveRecord::Base
>   belongs_to :continent
> end
>
> How can I do this further on, but with a larger number of tables (say A
> has many Bs that has many Cs that has many Ds etc...)?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to