Hello,
I’m breaking my head atm about table relations / associations in
Rails.
The idea is this: Collections has many mods, mods have many folders,
folders have many items.
A collection can have many different versions, the mods associated
with a collection, should ‘have the same version’.
Changelogs are linked to Version, but should differ per Mod.
If I work with ActiveScaffold, things become quite a mess, and I can
for instance create a Changelog entry, for a mod that is not part of
the chosen Collection, and so on.
This is basically what I have atm:
class Collection < ActiveRecord::Base
has_many :mods
has_many :versions
end
class Version < ActiveRecord::Base
belongs_to :collection
has_many :changelogs
end
class Mod < ActiveRecord::Base
belongs_to :collection
has_many :folders
has_many :changelogs
end
class Changelog < ActiveRecord::Base
belongs_to :version
belongs_to :mod
end
class Folder < ActiveRecord::Base
belongs to :mod
has_many :folders
end
class Item < ActiveRecord::Base
belongs to :folder
end
Anybody any ideas? Cheers