# Problem with associatotions

**URL:** <https://www.ruby-forum.com/t/problem-with-associatotions/119699>\
**Category:** Rails\
**Created:** [November 9, 2007, 10:55am UTC](https://www.ruby-forum.com/t/problem-with-associatotions/119699 "2007-11-09T10:55:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [November 9, 2007, 10:55am UTC](https://www.ruby-forum.com/t/problem-with-associatotions/119699/1 "2007-11-09T10:55:58Z")

</div>

I have these models:

class Vote \< ActiveRecord::Base  
belongs\_to :core  
belongs\_to :user\_id  
end

class User \< Core  
has\_many :votes  
end

class Core \< ActiveRecord::Base  
has\_many :votes  
end

the tables in db are:

cores(id,name)

votes(id,core\_id,user\_id,vote)

when i do some query to votes, the attribute core\_id is confused with  
user\_id.  
(core\_id is the user or others objects that are voted, user\_id is the  
voter)

How i can do to distinct the voter and the user voted?  
Thanks

---

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [November 9, 2007, 9:21pm UTC](https://www.ruby-forum.com/t/problem-with-associatotions/119699/2 "2007-11-09T21:21:56Z")

</div>

Hi, you might want to replace the “belongs\_to” with “has\_one”.
