Theory Question

I have a scenario where there is list of things (a list of chores for
example) that have two parts, task and description.

On an ongoing basis we assign a group of chores to people. Each assigned
chore can be tweaked – the description could be changed to say “don’t
forget to do x.”

In this case there is not a has_and_belongs_to (or many_through)
relationship between people and chores because we don’t want to edit the
main list of chores. We do want to go back later and see who had what
chore
and what the specific instructions were.

My current idea is:

Chore_Set has_many Chores (Chore_Set_id in each Chore) These chores have
no
overlap per set and are relatively set.

Chores_User is somehow populated by selecting a Chore_Set, giving a copy
of
the individual Chores. Chores_user has the User_Id.

Chores_User fields can then be edited or changed without changing the
original Chore or Chore_Set


Is there some predefined way of doing this? Some tutorial–something I
am
missing–some advice?

Thanks,
Sunny

On 19 Aug 2008, at 18:19, Sunny B. wrote:

what chore and what the specific instructions were.

why not just have chores has_many :users, :through => :assignments ?
The assignments model could carry all the user specific stuff
(customised description etc…)

Fred

why not just have chores has_many :users, :through => :assignments ?
The assignments model could carry all the user specific stuff
(customised description etc…)

+1

then, you could share the chores but have specific attributes for each
relation of user with chore. (description, due date…)

On Aug 19, 6:32 pm, Frederick C. [email protected]

Hi

On 19 aug, 19:19, “Sunny B.” [email protected] wrote:

I have a scenario where there is list of things (a list of chores for
example) that have two parts, task and description.

On an ongoing basis we assign a group of chores to people. Each assigned
chore can be tweaked – the description could be changed to say “don’t
forget to do x.”

I’m puzzled by this statement:

In this case there is not a has_and_belongs_to (or many_through)
relationship between people and chores because we don’t want to edit the
main list of chores.

What does editing the main list of chores have to do with the
has_many :through relationship? As Fred says, the easiest way would be
to actually link the tables together with a join model (assignments)
so you can track which user has which chore. But I also think to read
in your question the requirement to assign a group of chores to each
user, with the groups being pre-defined, rather than individual
chores. In that case, I would add an attribute to chore, the name of
the group it belongs to (or make a separate model for that) and still
assign individual chores to each user (but in the assignment method
and views, make sure you can only assign them by group).

Your question is still a bit ambiguous to me, not sure I’m on the
right track.

Dirk.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs