Topic: Naming DB fields for Active Record correctly

Quick question...

My database tables:
Orgs
Addresses
Addresses_Orgs
Contacts

My models:
-Orgs-
has_many :contacts
has_many :addresses_orgs

-Addresses-
has_many :addresses_orgs

-Addresses_Orgs-
belongs_to :address
belongs_to :org
has_many :contacts

-Contacts-
belongs_to :org
* belongs_to : addresses_orgs ?? (Is this the correct naming, it is plural not singular?)


In the

Last edited by amendoza (2007-03-27 19:20:40)

Re: Naming DB fields for Active Record correctly

This is working for contact's attributes:

addresses_org_id  <as column name(foreign key)in table>
&
belongs_to :addresses_org  <in the model>