Imagine we have 2 models
and you want to create a standard Joins Table with just an
When you create the table via a migration Rails will automatically create the joins table with the folloing naming convention in alphabetical order
If you then decided to change the
Area table to be called
Screen, one of the things you will likely do is write a migration to change the
areas_lanes table to be called
You may think Rails will therefore look for a joins table called
screens_lanes after all we have simply switched the
Area table for a
Unfortunately not, Rails will look for a table called
lanes_screens becuase it will keep to its alphabetical order naming convention.
So you will need something like this:
has_and_belongs_to_many :screens, join_table: "screens_lanes"