views:

25

answers:

1

I have a simple database that has the following relation.

Each Server has one Game.

now the table Game is just a list of the different games that are possible to have on the server.

However, when I do a @server.game, I get a SQL exception because it's trying to find the server's INSTANCE of it's game (Select * from games where games.server_id = 1) I'd really like it just to do (select * from games where games.id = @server.game_id)

Any clues as to how to perform this association?

+1  A: 

If Server has a belongs_to association to Game, the underlying SQL will then be what your are looking for

DanSingerman
while I feel completely retarded for not realizing that, I was simply being to literal with the associations.Thanks!
WedTM
In two years of Rails development I am yet to find a situation where has_one works better than belongs_to. That might just be me however...
DanSingerman