# Conflicting Attributes in Model and Join Table

**URL:** <https://www.ruby-forum.com/t/conflicting-attributes-in-model-and-join-table/55035>\
**Category:** Rails\
**Created:** [March 16, 2006, 3:47pm UTC](https://www.ruby-forum.com/t/conflicting-attributes-in-model-and-join-table/55035 "2006-03-16T15:47:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bradley\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7ba0ec/32.png) [@Bradley\_M](https://www.ruby-forum.com/u/Bradley_M)\
**Post date:** [March 16, 2006, 3:47pm UTC](https://www.ruby-forum.com/t/conflicting-attributes-in-model-and-join-table/55035/1 "2006-03-16T15:47:29Z")

</div>

Hi all,

I’ve got a Post and User classes. The Post has a user\_id attribute to  
point to the user that created it.

I want to implement favorites, so I made Post and User both  
“has\_and\_belongs\_to\_many” and created a favorites join table. The  
join table has a post\_id and a user\_id column.

Now when I get my post everything seems to be okay, but in some  
contexts, the user\_id get’s overwritten. I think that the user\_id  
from the join table is being merged into my Post instance.

What would you do differently so that there was no collision between  
my Post’s user\_id (the author) and the join table’s user\_id (for whom  
this post is a favorite)?

## Thanks, Brad

Bradley M.
