1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test
Steve Klabnik 14fc8b3452 Removing composed_of from ActiveRecord.
This feature adds a lot of complication to ActiveRecord for dubious
value. Let's talk about what it does currently:

class Customer < ActiveRecord::Base
  composed_of :balance, :class_name => "Money", :mapping => %w(balance amount)
end

Instead, you can do something like this:

    def balance
      @balance ||= Money.new(value, currency)
    end

    def balance=(balance)
      self[:value] = balance.value
      self[:currency] = balance.currency
      @balance = balance
    end

Since that's fairly easy code to write, and doesn't need anything
extra from the framework, if you use composed_of today, you'll
have to add accessors/mutators like that.

Closes #1436
Closes #2084
Closes #3807
2012-06-18 14:53:03 -04:00
..
active_record/connection_adapters Simplify AR configuration code. 2012-06-15 19:15:36 +01:00
assets
cases Removing composed_of from ActiveRecord. 2012-06-18 14:53:03 -04:00
fixtures
migrations
models Removing composed_of from ActiveRecord. 2012-06-18 14:53:03 -04:00
schema Add uuid type support to PostgreSQL adapter 2012-06-14 17:44:51 +04:00
support
.gitignore
config.example.yml
config.rb