Arivarasan L
Arivarasan L

Reputation: 9958

Rails naming convention for lengthy table name

Master tables: assortments, companies, submission_types

Mapped assortments with company in assortments_companies.

Mapped submission_types with company in companies_submission_types.

Now I want to map assortments_companies with companies_submission_types.

Is it good to have a table name with rails convention like this assortments_companies_companies_submission_types? So my model name will be AssortmentCompanyCompanySubmissionType.

Is there any better approach to over come the lengthy name?

Upvotes: 0

Views: 87

Answers (1)

Paul A Jungwirth
Paul A Jungwirth

Reputation: 24541

Very often many-to-many join tables between entities are really events, with extra attributes you want to track. Whenever I have a join table, I consider whether I can name it something more meaningful than just foos_bars. For instance between accounts and plans you don't have accounts_plans but subscriptions.

It is hard to suggest specific names without knowing your domain, but perhaps assortment_submissions or even just submissions?

Upvotes: 1

Related Questions