Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Rails has_many :profiles, based on :teams

I have a collaboration application I am working on. A User has_many :teams, through: :user_teams. Each Team belongs to an Industry. Based on the Career, the user's Profile (class) will vary. Say EngineerProfile, will have attributes like credentials and eng_level. Another profile is Accountant. The AccountProfile (class) will have different attrs. Based on the teams the user is associated with, the user will have one type of profile (1 x AccountantProfile, 1 x EngineerProfile, etc.) based on the many teams they are associated with and the Industry each team belongs to. What's the best way to safely create this deep relationship based on these contingencies?