1. 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
  2. 16 6月, 2012 1 次提交
  3. 10 6月, 2012 1 次提交
    • A
      Ensure that mass assignment options are preserved · c2e61aa6
      Andrew White 提交于
      There are two possible scenarios where the @mass_assignment_options
      instance variable can become corrupted:
      
      1. If the assign_attributes doesn't complete correctly, then
         subsequent calls to a nested attribute assignment method will use
         whatever options were passed to the previous assign_attributes call.
      
      2. With nested assign_attributes calls, the inner call will overwrite
         the current options. This will only affect nested attributes as the
         attribute hash is sanitized before any methods are called.
      
      To fix this we save the current options in a local variable and then
      restore these options in an ensure block.
      c2e61aa6
  4. 30 5月, 2012 1 次提交
  5. 27 5月, 2012 1 次提交
  6. 18 5月, 2012 1 次提交
  7. 17 5月, 2012 1 次提交
  8. 15 5月, 2012 3 次提交
  9. 12 5月, 2012 4 次提交
  10. 07 5月, 2012 1 次提交
  11. 05 5月, 2012 1 次提交
  12. 03 4月, 2012 1 次提交
    • B
      Removes caching from ActiveRecord::Core::ClassMethods#relation · 68677ffb
      Benedikt Deicke 提交于
      The #relation method gets called in four places and the return value was instantly cloned in three of them. The only place that did not clone was ActiveRecord::Scoping::Default::ClassMethods#unscoped. This introduced a bug described in #5667 and should really clone the relation, too. This means all four places would clone the relation, so it doesn't make a lot of sense caching it in the first place.
      
      The four places with calls to relations are:
      
      activerecord/lib/active_record/scoping/default.rb:110:in `block in build_default_scope'"
      activerecord/lib/active_record/scoping/default.rb:42:in `unscoped'"
      activerecord/lib/active_record/scoping/named.rb:38:in `scoped'"
      activerecord/lib/active_record/scoping/named.rb:52:in `scope_attributes'"
      68677ffb
  13. 30 3月, 2012 1 次提交
  14. 15 3月, 2012 1 次提交
  15. 14 3月, 2012 1 次提交
  16. 04 3月, 2012 1 次提交
    • C
      Initialize @stale_state to nil in association · 9b9357b2
      Carlos Antonio da Silva 提交于
      This apparently fix the warning related to @new_record variable not
      being initialized in AR's test suit, when an association is built and
      the object is marshalled/loaded.
      
      See these tests in AR's base_test.rb:
      
      test_marshalling_with_associations
      test_marshalling_new_record_round_trip_with_associations
      
      Closes #3720.
      9b9357b2
  17. 14 2月, 2012 1 次提交
  18. 08 2月, 2012 4 次提交
  19. 07 2月, 2012 1 次提交
  20. 29 1月, 2012 1 次提交
  21. 26 1月, 2012 1 次提交
  22. 21 1月, 2012 2 次提交
  23. 20 1月, 2012 1 次提交
  24. 12 1月, 2012 1 次提交
  25. 07 1月, 2012 1 次提交
  26. 05 1月, 2012 2 次提交
  27. 29 12月, 2011 3 次提交
    • J
      Delete some stray lines · 88d2af5b
      Jon Leighton 提交于
      88d2af5b
    • J
      Support establishing connection on ActiveRecord::Model. · dae7b654
      Jon Leighton 提交于
      This is the 'top level' connection, inherited by any models that include
      ActiveRecord::Model or inherit from ActiveRecord::Base.
      dae7b654
    • J
      Support configuration on ActiveRecord::Model. · 93c1f11c
      Jon Leighton 提交于
      The problem: We need to be able to specify configuration in a way that
      can be inherited to models that include ActiveRecord::Model. So it is
      no longer sufficient to put 'top level' config on ActiveRecord::Base,
      but we do want configuration specified on ActiveRecord::Base and
      descendants to continue to work.
      
      So we need something like class_attribute that can be defined on a
      module but that is inherited when ActiveRecord::Model is included.
      
      The solution: added ActiveModel::Configuration module which provides a
      config_attribute macro. It's a bit specific hence I am not putting this
      in Active Support or making it a 'public API' at present.
      93c1f11c
  28. 24 12月, 2011 1 次提交