Re: question about has_many belongs_to association

I don't know if this is the reason for the error, but you are passing params[:id] here. Are you trying to assign the value of some attribute while building the league? The method is expecting a hash instead.

Re: question about has_many belongs_to association

Good catch gmacgregor. The :scores should be plural. That wouldn't have effected the build_league method though. This is generated by the "belongs_to" method and is the same as "League.new(...)" but automatically sets the @score.league_id to the value of the created league.

I see the problem now, here rburbach is fetching multiple scores with "find(:all)". The build_league method should be called on a single Score record. I'm not really sure what you are trying to do here with build_league actually.

Re: question about has_many belongs_to association

well the reason for making the assocition is because I want to display the league name that is associated with the score item. I am using the foreign key to reference the league table of course. I will need to do the same with my team table in order to display the team name rather than the team foreign key id...