Design Element
Comment on "Class Composition in Rails"
by labrat — Dec 24
I haven't tried this (on a composed class but it works for other habtm association stuff) but you should be able to use delegate.

Add something like this under the class header:

delegate :city, :to => :address

Check out this post.

Otherwise you can implement your own accessor method.
Back to "Class Composition in Rails"
Design Element

Copyright © Scott Stevenson 2004-2015