Rails naming convention for join table

Viewed 33370

This questions stems from: How to link form after creating rails join table

I am creating the join table between my Product and Category Models.

What should the join table be named? categories_products or category_products or something else?

4 Answers

The new create_join_table migration creates a join table that has no corresponding model, so no naming convention is required for the model name.

To access the join, you must declare has_and_belongs_to_many on the two tables, and access them through the association created.

Related