[Rails] DB Modelling the Rails way - Opinions??
Eric Sloane
esloane at exemail.com.au
Mon Jan 2 01:10:51 GMT 2006
Hi,
I'm trying to figure the most efficient way to model the following. I
can think of at least two ways to relate the tables but from a
client/server perspective! I'm wondering how to best (and
elegantly)relate them from an AR perspective.
A project has many people,
A person can work on many projects at any time,
A project has many roles,
A role is performed by a person,
A person may perform multiple roles,
An organisation has many people,
An organisation is a stakeholder (God, I hate that word - makes me feel
like Dracula surrounded!)in one or more projects,
A stakeholder has many roles within a project.
So one way I have
Projects HABTM Roles
Roles HABTM People
Organisation Has_Many People
An Organisation Belongs_to a Stakeholder
A Stakeholder HABTM Projects
A Stakeholder Has_Many Roles
Or
Projects HABTM People,
A Project has_many roles,
People HABTM Roles,
An Organisation has_many People,
An Organisation is a Stakeholder in a Project,
A Stakeholder has_many Roles in a Project.
I guess the outcome I'm after is a way to view this data from various
perspectives. For example, I have a project view that presents static
project data at the head of the screen with a set of tabs containing
partials with forms for editing stuff like e.g. People
Acting_For(Stakeholder), Acting_As (Role). Other perspectives would be
like seeing which organisations are doing what within any number of
projects - that sorta thing.
Whatya think?
Eric.
More information about the Rails
mailing list