diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-18 22:59:53 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-18 23:00:08 -0300 |
commit | df2104e06784a4b98d8f30cb3ea4eee69304e768 (patch) | |
tree | 6a288d350eee7a817c5bb990cd3c00f539b74872 /activerecord | |
parent | 27411a7c8d1c184876b1cb40ecdd07772551e6dd (diff) | |
download | rails-df2104e06784a4b98d8f30cb3ea4eee69304e768.tar.gz rails-df2104e06784a4b98d8f30cb3ea4eee69304e768.tar.bz2 rails-df2104e06784a4b98d8f30cb3ea4eee69304e768.zip |
Improve the CHANGELOG entry [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 21 |
1 files 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* |