From df2104e06784a4b98d8f30cb3ea4eee69304e768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 18 Jun 2012 22:59:53 -0300 Subject: Improve the CHANGELOG entry [ci skip] --- activerecord/CHANGELOG.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index a617cef6a1..cc18981e93 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,8 +1,25 @@ ## Rails 4.0.0 (unreleased) ## -* `composed_of` has removed. You'll have to write your own accessor +* `composed_of` was removed. You'll have to write your own accessor and mutator methods if you'd like to use value objects to represent some - portion of your models. + portion of your models. So, instead of: + + class Person < ActiveRecord::Base + composed_of :address, :mapping => [ %w(address_street street), %w(address_city city) ] + end + + you could write something like this: + + def address + @address ||= Address.new(address_street, address_city) + end + + def address=(address) + self[:address_street] = @address.street + self[:address_city] = @address.city + + @address = address + end *Steve Klabnik* -- cgit v1.2.3