• S
    Removing composed_of from ActiveRecord. · 14fc8b34
    Steve Klabnik 提交于
    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
    14fc8b34
README.rdoc 6.5 KB