[Rails] Re: Best way to collect child rows

2008-12-17 Thread Matt Harrison
Jeff wrote: I'm trying to find the best way to handle this task, and I'm not having much luck. I think I lack knowledge of the terminology to research this. I have these models: Account, which has many Pages Page, has many Items Item, has many Tags (through a join model: ItemTag) Tag,

[Rails] Re: Best way to collect child rows

2008-12-17 Thread Jeff
What I have now is similar, but using has_many :through instead of habtm. What I'm looking for is something functionally equivalent to: account = Account.find(:first) account.tags # returns all tags across all items, on all pages Note that the tags are actually associated with items, which are

[Rails] Re: Best way to collect child rows

2008-12-17 Thread Matt Harrison
Jeff wrote: What I have now is similar, but using has_many :through instead of habtm. What I'm looking for is something functionally equivalent to: account = Account.find(:first) account.tags # returns all tags across all items, on all pages Note that the tags are actually associated

[Rails] Re: Best way to collect child rows

2008-12-17 Thread Ryan Bigg
def tags pages.map(:items).map(:tags) end If you must. --~--~-~--~~~---~--~~ 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