I have 3 models (User, Team and League) and I'd like to establish the following relationship between them:
- A User can own multiple Teams.
- A League consists of multiple Teams and it's owned by a User.
- A Team belongs to a User and to a League at the same time.
I'm new to Ruby on Rails and I can't seem to figure out how to represent these relationships. When I try to test the models I'm getting errors when I instance a Team because I don't know how to .build a Team from a User and a League at the same time. Any help would be much appreciated, thanks in advance.
Aucun commentaire:
Enregistrer un commentaire