ign/ipl-viper — pull request #74 by yobennett (2013-04-11 22:15:19+00:00)
Title: be explicit about matchup-team relations

After upgrading the Mongoid library, we discovered that the we were
not explicit enough in stating habtm relationships. For example,
when assigning `teams` to a `matchup`, we ran into the following error:

```
Mongoid::Errors::AmbiguousRelationship:
Problem:
Ambiguous relations :matchups, :matchups_won defined on Team.
Summary:
When Mongoid attempts to set an inverse document of a relation in memory, it needs to know which relation it belongs to. When setting :teams, Mongoid looked on the class Matchup for a matching relation, but multiples were found that could potentially match: :matchups, :matchups_won.
Resolution:
On the :teams relation on Matchup you must add an :inverse_of option to specify the exact relationship on Team that is the opposite of :teams.
```

So we change the `Team` model with a habtm relation to `Matchups` from `has_and_belongs_to_many :matchups` to `has_and_belongs_to_many :matchups, class_name: "Matchup", inverse_of: :teams`.