I am building a Ruby on Rails application that will have data dumped into my PostgreSQL installation pretty regularly. Right now I have two entities, Accounts and Addresses.
Accounts has many Addresses. As of now the foreign key relationship is setup as Rails defaults it, where Addresses has a column called account_id
. However Rails is never going to create the data, it is just going to read it. My external service that is dumping data creates a unique ID called masterID
onto my account records, and places that ID into the associatedID
column of the associated addresses.
I need Rails to use the masterID
field and associatedID
field when looking for associated addresses.
Does anyone know how I would go about doing that?