# Theory Question

**URL:** <https://www.ruby-forum.com/t/theory-question/146284>\
**Category:** Rails\
**Created:** [August 19, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/theory-question/146284 "2008-08-19T19:20:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 19, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/theory-question/146284/1 "2008-08-19T19:20:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 19, 2008, 7:33pm UTC](https://www.ruby-forum.com/t/theory-question/146284/2 "2008-08-19T19:33:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 20, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/theory-question/146284/3 "2008-08-20T14:15:00Z")

</div>

> 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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 21, 2008, 12:11pm UTC](https://www.ruby-forum.com/t/theory-question/146284/4 "2008-08-21T12:11:45Z")

</div>

Hi

On 19 aug, 19:19, “Sunny B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.
