How to handle asset groups within groups?

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?



acts_as_tree might work nicely for this.

Thanks twice-over, Erol :slight_smile: I’ll look at those to see how they work