Join table with attributes


#1

Hi folks,

I’m trying to migrate a less-than-ideal schema for a Rails app that
helps
role-playing gamers (the pencil-and-paper type) connect with each other,
at
http://findplay.anvilwerks.com (the source is available there too, 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 operation would apparently kill all
entries that match on the player_id and game_id columns, ignoring
differences in status. Is this still an issue? Or has it been fixed in
Rails
1.0? Is the usage different from what’s suggested on the wiki? (I can’t
seem
to find this link again, or I’d include it–my apologies.)

–JB