Topic: Association help
I'm altering my personal website to alter how my galleries work. Currently I have an albums page which just lists all my albums and each album has a number of photos.
I am now adding collections to the mix.
- Albums live in collections
- A collection can house other collections but not other collections and albums at the same level
- Never more than 3 collection levels deep so c1 > c2 > c3 >a1
- 1 album can only belong to 1 collection at a time
On each of my albums I have the id of it's parent collection and the relationships defined are:
- Collection has_many Albums
- Album belongs_to Collection
now, Where I am getting confused is that a collection can belong to another collection or can be a top level (root) collection and how to specify this relationship.
Any ideas on what I should do here?