Topic: Hey, could use some help on some DB design.

I have not been here in a while, jeez! Shows that I must be learning a lot on my own these days smile

Alright, so here it is.

Let's say that there is a task model. Since a task is meant to be assigned to a person, I need to create a way for that to be done in an association.

The thing is, I'm not exactly sure the best way to even call this association.

A task should have a creator and someone it's "assigned to".

A user should be able to list all the tasks that they belong to.

A user should be able to see who created that task.

Now, I assume this is going to be two foreign keys.

Something like a task belonging to both a creator and assigned to?

Anyway, I could use some help in modeling this out, especially with some good names. Thanks!

(I would appreciate if you showed me the model code for the association)

Thanks! - Personal Web-Technology-Blog, Los Angeles.

Re: Hey, could use some help on some DB design.

How about:

belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
belongs_to :user
# or :delegate, or :assignee

has_many :owned_tasks, :class_name => 'Task', :foreign_key => 'creator_id'
has_many :assigned_tasks