TKChattoraj / Play_Ball

Baseball League Site
0 stars 0 forks source link

Validate presence of has_many through association #8

Closed TKChattoraj closed 8 years ago

TKChattoraj commented 8 years ago

want to validate that a user has a team through joint_table roster before saving user.

TKChattoraj commented 8 years ago

This is done within the context of the Roster model. It validates that :team_id is present (and user_id too). This validation is done upon the creation of a Roster object, the creation of which establishes the user/team relationship. Validating that the user model relates to the team through the Roster model is not done within the User model context but the Roster model context instead.