Hi, you might want to replace the "belongs_to" with
"has_one".
On Nov 9, 2007 4:55 AM, Luca Roma
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> 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
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---