Is this a relationship that can be described in Ruby on Rails' ActiveRecord model relationships?
Customer Address
=================== =========
Billing_Address_Id >------}
}---|- AddressId
Shipping_Address_Id >------}
So that I could have data that looks like this:
Address:
Id | Addr | City | State | Zip |
================================================
1 | 123 Main | New York | NY | 99999 |
2 | 200 2nd Street | New York | NY | 99999 |
3 | 300 3rd Street | Albany | NY | 99998 |
4 | PO Box 4 | Albany | NY | 99998 |
Customer:
Id | Name | Billing_Address_Id | Shipping_Address_Id |
=======================================================
1 | Bob | 1 | 1 |
2 | Al | 2 | 1 |
3 | Joe | 3 | 4 |
I want to store addresses in their own table because the data may be shared across customers (shipping address especially). But there would only even be two addresses for any given customer.
I'd like to avoid a many-to-many relationship unless there is no other way.