From 7b42a1d0ac2aa1c7ba544949bd14c2f166293b00 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 23 Oct 2007 17:39:35 +0000 Subject: Assigning an instance of a foreign class to a composed_of aggregate calls an optional conversion block. Refactor and simplify composed_of implementation. Closes #6322. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/fixtures/customer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/customer.rb b/activerecord/test/fixtures/customer.rb index ccbe035931..3d8d644f12 100644 --- a/activerecord/test/fixtures/customer.rb +++ b/activerecord/test/fixtures/customer.rb @@ -1,6 +1,6 @@ class Customer < ActiveRecord::Base composed_of :address, :mapping => [ %w(address_street street), %w(address_city city), %w(address_country country) ], :allow_nil => true - composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) + composed_of(:balance, :class_name => "Money", :mapping => %w(balance amount)) { |balance| balance.to_money } composed_of :gps_location, :allow_nil => true end @@ -52,4 +52,4 @@ class GpsLocation def ==(other) self.latitude == other.latitude && self.longitude == other.longitude end -end \ No newline at end of file +end -- cgit v1.2.3