for has_and_belongs_to_many table name should be in singular or plural

115 Views Asked by At

for has_many we will use plural definitely for belongs_to we will use singular for ex: has_many :users belongs_to: user

But for has_and_belongs_to_many has_and_belongs_to_many :user, join_table: :blocked_contacts here it should be user or users

1

There are 1 best solutions below

0
darkinSyde On BEST ANSWER

It should be has_and_belongs_to_many :users, because it is a many-to-many relationship. You can find more info here.