search for: zip_code_id

Displaying 1 result from an estimated 1 matches for "zip_code_id".

2006 Jun 16
3
Does HABTM support non "id" FKs?
Quick question. Say I have a geographical database with counties and zip codes where counties have and belong to many zip codes. zip_codes (id, zip_code) counties (id, name) When I create the association table, the Rails way says to do the following: counties_zip_codes (county_id, zip_code_id). However, given that zip_codes.zip_code is itself a candidate key, I would much prefer to do the following: counties_zip_codes (county_id, zip_code), as this removes the need to join with the 42K record zip_codes table. However, when I do the following in the my model: class ZipCode < Act...