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 ActiveRecord Basics Migrations and Relationships Has and Belongs to Many

Why do we create the employee_projects table, but not a corresponding model?

Is it because the table is merely a join of two other tables with their own model? I'm not quite following why we create a table here, but no EmployeeProject model. Can someone please elaborate?

Thanks

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Join tables like this do not need a model, because you won't be performing any operations on the join table's objects directly - they won't even have any IDs. That's how it works in HABTM association. You would create a model for a join table in the Has Many Through association.