Imagine a roster of characters in a game.
I need to let users vote on which character counters which character and be able to save that in the database.
Batman is strong against Superman
Batman is strong against Joker
Batman is weak against The Riddler
How can I model this relationship between two of the same type of models? Batman, Superman and Joker
are all part of the same Model type Superhero
.
If I were to create this same system on something like ASP.Net MVC, I would create a table called Counterpicks
and have two fields source_id
and target_id
as int fields and use them as foreign keys towards the Superhero
table. Do I need to create a Counterpick
model in RoR?
Any suggestions?