1. 31 5月, 2016 1 次提交
    • S
      Ensure hashes can be passed to attributes using `composed_of` · ff4986b9
      Sean Griffin 提交于
      This behavior was broken by 36e9be85. When the value is assigned
      directly, either through mass assignment or directly assigning a hash,
      the hash gets passed through to this writer method directly. While this
      is intended to handle certain cases, when an explicit converter has been
      provided, we should continue to use that instead. The positioning of the
      added guard caused the new behavior to override that case.
      
      Fixes #25210
      ff4986b9
  2. 29 11月, 2014 1 次提交
  3. 28 7月, 2012 1 次提交
  4. 19 6月, 2012 1 次提交
    • 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
  5. 22 5月, 2012 1 次提交
  6. 03 5月, 2012 1 次提交
    • Y
      allow the :converter Proc form composed_of to return nil · fa5f0375
      Yves Senn 提交于
      This makes it possible to filter invalid input values before they are passed
      into the value-object (like empty strings). This behaviour is only relevant
      if the :allow_nil options is set to true. Otherwise you will get
      the resulting NoMethodError.
      fa5f0375
  7. 08 1月, 2011 1 次提交
  8. 11 9月, 2008 1 次提交
  9. 18 1月, 2008 1 次提交
  10. 24 10月, 2007 1 次提交
  11. 22 5月, 2006 1 次提交
  12. 07 4月, 2006 1 次提交
  13. 08 12月, 2005 1 次提交
  14. 02 3月, 2005 1 次提交
  15. 24 11月, 2004 1 次提交