aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-23 17:39:35 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-23 17:39:35 +0000
commit7b42a1d0ac2aa1c7ba544949bd14c2f166293b00 (patch)
tree313ee38b221b8548b5e2cb4b08d26e26150faa5c /activerecord/test/fixtures
parentc220e558be33e30a7946d3604d45ba671b2e7c31 (diff)
downloadrails-7b42a1d0ac2aa1c7ba544949bd14c2f166293b00.tar.gz
rails-7b42a1d0ac2aa1c7ba544949bd14c2f166293b00.tar.bz2
rails-7b42a1d0ac2aa1c7ba544949bd14c2f166293b00.zip
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
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/customer.rb4
1 files changed, 2 insertions, 2 deletions
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