Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # table 'customers' has columns 'adr_street', 'adr_city', 'adr_zip'
- class Customer < ActiveRecord::Base
- composed_of :customer_address,
- :mapping => [['adr_street', 'street'], ['adr_city', 'city'], ['adr_zip','zip']]
- end
- class CustomerAddress
- attr_reader :street, :city, :zip
- def initialize(street,city,zip) ; @street,@city,@zip = street,city,zip ; end
- def close_to?(other_address) ; ... ; end
- def ==(other_address) ; ... ; end
- end
Advertisement
Add Comment
Please, Sign In to add comment