Thanks twice-over, Erol :) I'll look at those to see how they work On Wed, Oct 1, 2008 at 9:20 PM, Erol Fornoles <[EMAIL PROTECTED]>wrote:
> > On Oct 2, 9:52 am, "Sean Clark Hess" <[EMAIL PROTECTED]> wrote: > > Hi Everyone, > > I'm stumped. Imagine I have a bunch of assets. I want to be able to group > > them together (like in graphics programs), and then be able to group them > > into further groups. > > > > What is the best way to do this? > > > > 1) I could have two models, Asset and AssetGroup, where Asset has_a url, > and > > AssetGroup has_many Assets and has_many AssetGroups. > > > > 2) I could have one model: Asset, which has_a url and has_many Assets, > where > > if it has a url it's a "leaf" asset, and if it has some assets, it's a > > "branch." It could have a type field, too. > > > > 3) Something else? > > > > The reason this is difficult is because I want to have other models be > able > > to contain either an Asset or an Asset group, and treat them as the > roughly > > the same thing. > > > > How would you go about doing this? > > > > Thanks > > ~sean > > acts_as_tree might work nicely for this. > > http://wiki.rubyonrails.org/rails/pages/ActsAsTree > http://api.rubyonrails.com/classes/ActiveRecord/Acts/Tree/ClassMethods.html > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

