Rails associations using build_association and create_association helpers

I have users has_one profile, profiles has_many schools, schools
has_many
teams I’m trying to write the new and create actions for the teams
controller i’m not sure what they should be, i have something like
@team=
current_user.profile.build_team(team_params) which i’ve been trying
different variations of

On 7 January 2016 at 11:32, fugee ohu [email protected] wrote:

I have users has_one profile, profiles has_many schools, schools has_many
teams I’m trying to write the new and create actions for the teams
controller i’m not sure what they should be, i have something like @team=
current_user.profile.build_team(team_params) which i’ve been trying
different variations of

You are making the same mistake you did before. You cannot use
profile.build_team because there is not an appropriate relation
between profile and team.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs