Hi guys. So I have a few models: Concept, Entity, Dimension, Rating, User and Fact
1) Concepts can have many dimensions and many entities and many facts. 2) Concepts may share dimensions, but not entities or facts (so the Concept universities can share the Dimension quality but not the Fact num_students. 3) A rating is determined by allowing a user to rate each dimension defined over the concept the entity belongs to.
I'm trying to design the relationships on paper before starting, and I thought I'd run it by you guys for suggestions, improvements, advice, etc (I'm quite new to rails and ruby).
def Dimension has_and_belongs_to_many :concepts # for the ratings table has_many :ratings has_many :entities, :through => :ratings has_many :users, :through => :ratings def Fact def Entity # for the ratings table has_many :ratings has_many :dimensions, :through => :ratings has_many :users, :through => :ratings def Concept has_and_belongs_to_many :dimensions has_many :entities, :dependent => :destroy has_many :facts, :dependent => :destroy def User # for the ratings table has_many :ratings has_many :dimensions, :through => :ratings has_many :entities, :through => ratings def Rating # the ratings table also has a value field when a user rates an entity's dimension belongs_to :dimensions belongs_to :users belongs_to :entities
Thanks in advance