joining tables question

0 views
Skip to first unread message

berthor

unread,
Jul 1, 2008, 4:30:58 PM7/1/08
to ChicagoRuby.org
I've been working on a little home grown project, and i'm not sure how
to add in a bit of logic here.

I have a user, game, server, character, and comments table. but how
would I go about getting all the entries from just one user?

currently I'm joining the table with belongs_to and has_many, and
has_many through in my model. would the easiest way to do this be to
add the user_id to every field in my join tables? example = > gslink
= Game Server join table. right now in this table, i have
game_id:integer and server_id:integer and I was wondering if I should
add a user_id:integer and find all who's user_id = logged in user's id
at the time of displaying the information? or should I do something
else?

thanks in advance.

Matt Polito

unread,
Jul 1, 2008, 9:22:05 PM7/1/08
to ChicagoRuby.org
look up has_many :through. that will probably help.

berthor

unread,
Jul 2, 2008, 10:26:36 AM7/2/08
to ChicagoRuby.org
as I stated originally, i am using has_many through, I was just
wondering if that would be easier then anything other type of
solution. it probably is the easiest solution, just wanted
confirmation I guess.

Nick
Reply all
Reply to author
Forward
0 new messages