1. 29 10月, 2016 1 次提交
  2. 22 10月, 2016 1 次提交
  3. 30 9月, 2016 1 次提交
    • S
      Don't skip in-memory insertion of associations when loaded in validate · 268a5bb0
      Sean Griffin 提交于
      This was caused by 6d0d83a3. While the
      bug it's trying to fix is handled if the association is loaded in an
      after_(create|save) callback, it doesn't handle any cases that load the
      association before the persistence takes place (validation, or before_*
      filters). Instead of caring about the timing of persistence, we can just
      ensure that we're not double adding the record instead.
      
      The test from that commit actually broke, but it was not because the bug
      has been re-introduced. It was because `Bulb` in our test suite is doing
      funky things that look like STI but isn't STI, so equality comparison
      didn't happen as the loaded model was of a different class.
      
      Fixes #26661.
      268a5bb0
  4. 17 9月, 2016 1 次提交
  5. 16 8月, 2016 3 次提交
  6. 14 8月, 2016 2 次提交
  7. 07 8月, 2016 3 次提交
  8. 26 7月, 2016 2 次提交
  9. 20 7月, 2016 1 次提交
  10. 18 7月, 2016 1 次提交
  11. 19 5月, 2016 1 次提交
  12. 11 2月, 2016 1 次提交
  13. 10 2月, 2016 1 次提交
  14. 04 2月, 2016 1 次提交
  15. 23 11月, 2015 1 次提交
  16. 16 11月, 2015 1 次提交
    • Y
      Except keys of `build_record`'s argument from `create_scope` in initialize_attributes · 817c1825
      yui-knk 提交于
      If argument of `build_record` has key and value which is same as
      default value of database, we should also except the key from
      `create_scope` in `initialize_attributes`.
      Because at first `build_record` initialize record object with argument
      of `build_record`, then assign attributes derived from Association's scope.
      In this case `record.changed` does not include the key, which value is
      same as default value of database, so we should add the key to except list.
      
      Fix #21893.
      817c1825
  17. 21 10月, 2015 1 次提交
  18. 19 10月, 2015 1 次提交
    • J
      Reorder application of has_many association constraints. · d9bb13ba
      jbranchaud 提交于
      With `unscope!` called last, it undoes `where` constraints of the same
      value when the `where` is chained after the `unscope`. This is what a
      `rewhere` does. This is undesirable behavior.
      
      The included tests demonstrate both the `unscope(...).where(...)`
      behavior as well as the direct use of `rewhere(...)`.
      
      This is in reference to #21955.
      d9bb13ba
  19. 23 9月, 2015 1 次提交
  20. 12 9月, 2015 1 次提交
  21. 03 9月, 2015 1 次提交
    • B
      HasManyAssociation: moved half of counter cache code to reflection · 712fc8a5
      Bogdan Gusiev 提交于
      Current implementation has a lot of utility methods that accept
      reflection call a lot of methods on it and exit.
      
      E.g. has_counter_cache?(reflection)
      
      It causes confusion and inability to cache result of the method even
      through it always returns the same result for the same reflection
      object.
      It can be done easier without access to the association context
      by moving code into reflection itself.
      
      e.g. reflection.has_counter_cache?
      
      Reflection is less complex object than association so moving code there
      automatically makes it simplier to understand.
      712fc8a5
  22. 03 8月, 2015 1 次提交
  23. 24 7月, 2015 1 次提交
    • S
      `destroy` shouldn't raise when child associations fail to save · d937a117
      Sean Griffin 提交于
      Deep down in the association internals, we're calling `destroy!` rather
      than `destroy` when handling things like `dependent` or autosave
      association callbacks. Unfortunately, due to the structure of the code
      (e.g. it uses callbacks for everything), it's nearly impossible to pass
      whether to call `destroy` or `destroy!` down to where we actually need
      it.
      
      As such, we have to do some legwork to handle this. Since the callbacks
      are what actually raise the exception, we need to rescue it in
      `ActiveRecord::Callbacks`, rather than `ActiveRecord::Persistence` where
      it matters. (As an aside, if this code wasn't so callback heavy, it
      would handling this would likely be as simple as changing `destroy` to
      call `destroy!` instead of the other way around).
      
      Since we don't want to lose the exception when `destroy!` is called (in
      particular, we don't want the value of the `record` field to change to
      the parent class), we have to do some additional legwork to hold onto it
      where we can use it.
      
      Again, all of this is ugly and there is definitely a better way to do
      this. However, barring a much more significant re-architecting for what
      I consider to be a reletively minor improvement, I'm willing to take
      this small hit to the flow of this code (begrudgingly).
      d937a117
  24. 21 7月, 2015 1 次提交
    • R
      Deprecate and rename the keys for association restrict_dependent_destroy · b184398b
      Roque Pinel 提交于
      Previously `has_one` and `has_many` associations were using the
      `one` and `many` keys respectively. Both of these keys have special
      meaning in I18n (they are considered to be pluralizations) so by
      renaming them to `has_one` and `has_many` we make the messages more
      explicit and most importantly they don't clash with linguistical
      systems that need to validate translation keys (and their
      pluralizations).
      
      The `:'restrict_dependent_destroy.one'` key should be replaced with
      `:'restrict_dependent_destroy.has_one'`, and
      `:'restrict_dependent_destroy.many'` with
      `:'restrict_dependent_destroy.has_many'`.
      
      [Roque Pinel & Christopher Dell]
      b184398b
  25. 17 7月, 2015 1 次提交
    • P
      Silence deprecation warning from force reload · b5b89796
      Prem Sichanugrist 提交于
      We deprecate the support for passing an argument to force reload in
      6eae366d. That led to several
      deprecation warning when running Active Record test suite.
      
      This commit silence the warnings by properly calling `#reload` on the
      association proxy or on the association object instead. However, there
      are several places that `ActiveSupport::Deprecation.silence` are used as
      those tests actually tests the force reload functionality and will be
      removed once `master` is targeted next minor release (5.1).
      b5b89796
  26. 16 7月, 2015 1 次提交
    • P
      Deprecate force association reload by passing true · 6eae366d
      Prem Sichanugrist 提交于
      This is to simplify the association API, as you can call `reload` on the
      association proxy or the parent object to get the same result.
      
      For collection association, you can call `#reload` on association proxy
      to force a reload:
      
          @user.posts.reload   # Instead of @user.posts(true)
      
      For singular association, you can call `#reload` on the parent object to
      clear its association cache then call the association method:
      
          @user.reload.profile   # Instead of @user.profile(true)
      
      Passing a truthy argument to force association to reload will be removed
      in Rails 5.1.
      6eae366d
  27. 02 5月, 2015 1 次提交
  28. 21 4月, 2015 1 次提交
    • A
      Rename association option :class to :anonymous_class · ac2b7a5c
      Andrew White 提交于
      In 1f006c an option was added called :class to allow passing anonymous
      classes to association definitions. Since using :class instead of
      :class_name is a fairly common typo even amongst experienced developers
      this can result in hard to debug errors arising in raise_on_type_mismatch?
      
      To fix this we're renaming the option from :class to :anonymous_class as
      that is a more correct description of what the option is for. Since this
      was an internal, undocumented option there is no need for a deprecation.
      
      Fixes #19659
      ac2b7a5c
  29. 09 4月, 2015 1 次提交
  30. 04 4月, 2015 1 次提交
  31. 16 3月, 2015 1 次提交
  32. 28 2月, 2015 1 次提交
  33. 21 2月, 2015 1 次提交
  34. 13 2月, 2015 1 次提交