search for: games_players

Displaying 3 results from an estimated 3 matches for "games_players".

Did you mean: game_player
2006 Feb 19
4
Multiple HABTM to one table
...ord::Base has_and_belongs_to_many :players, :uniq => true has_and_belongs_to_many :victors, :class_name => ''Player'', :uniq => true end When I add Player A to players, and Player B to victors, and save the game, there is no INSERT for games_victors, but there is for games_players. I cannot figure out why this is so. Furthermore, when I load the game, there are two SELECTs with JOINS to GAMES_PLAYERS, instead of one for GAMES_PLAYERS and one for GAMES_VICTORS. What have I done wrong? David
2006 Apr 07
5
Confusion about has_many / belongs_to ...
I have a table called players and its model Player, and I have a table called games and its model Game. In the games table I have: player1_id int(11) player2_id int(11) I want the tables to be associated so that I can access the player objects using table.player1 and table.player2 rather than having to lookup the objects based on the ids. I am not sure how to go about this but I suspect I
2006 Jan 01
0
Join table with attributes
...o, for the curious). The schema currently uses columns for played_games, wanted_games, and favorite_games in the players table; each of these holds a foreign key to the games table, as you might expect. Code has to be written three times to address these different columns. An obvious solution is a games_players join table with a status column to contain "wanted," "played," or "favorite." However in searching online I find that, according to the rails wiki, join tables with attributes are problematic. I can use push_attributes to get that status attribute, but a delete operat...