Theocacao
Leopard
Design Element
Comment on "Class Composition in Rails"
by Scott Stevenson — Dec 25
Does that mean you can't have several people using the _same_ address

Each person has its own address data. So yes, you can. In terms of SQL, it's no different than if the address, city, state and zip were part of person itself.

The advantage of this seems to be that you have more flexibility in code with Address data being loaded as its own class. In other words, you can add methods to Address that might not make sense to add to Person. This is just guessing on my part. There might be a better explanation.
Back to "Class Composition in Rails"
Design Element

Copyright © Scott Stevenson 2004-2015