1. 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
  2. 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
  3. 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
  4. 02 5月, 2015 1 次提交
  5. 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
  6. 04 4月, 2015 1 次提交
  7. 16 3月, 2015 1 次提交
  8. 28 2月, 2015 1 次提交
  9. 21 2月, 2015 1 次提交
  10. 13 2月, 2015 1 次提交
  11. 28 1月, 2015 1 次提交
    • S
      `WhereClause#predicates` does not need to be public · d26dd008
      Sean Griffin 提交于
      The only place it was accessed was in tests. Many of them have another
      way that they can test their behavior, that doesn't involve reaching
      into internals as far as they did. `AssociationScopeTest` is testing a
      situation where the where clause would have one bind param per
      predicate, so it can just ignore the predicates entirely. The where
      chain test was primarly duplicating the logic tested on `WhereClause`
      directly, so I instead just make sure it calls the appropriate method
      which is fully tested in isolation.
      d26dd008
  12. 26 1月, 2015 1 次提交
  13. 16 1月, 2015 1 次提交
  14. 31 12月, 2014 1 次提交
  15. 09 12月, 2014 1 次提交
  16. 29 11月, 2014 1 次提交
  17. 28 11月, 2014 1 次提交
  18. 26 11月, 2014 1 次提交
    • S
      Setting an association replaces records with the same id in memory · dd986814
      Sean Griffin 提交于
      The records weren't being replaced since equality in Active Record is
      defined in terms of `id` only. It is reasonable to expect that the
      references would be replaced in memory, even if no queries are actually
      executed. This change did not appear to affect any other parts of the
      code base. I chose not to execute callbacks since we're not actually
      modifying the association in a way that will be persisted.
      
      Fixes #17730
      dd986814
  19. 14 11月, 2014 1 次提交
  20. 08 11月, 2014 1 次提交
  21. 30 10月, 2014 1 次提交
    • T
      Add specs for adding-to/clear has_many collections’s behavior on `updated_at` · 9f48e75a
      Tu Hoang 提交于
      There are behaviors mentioned in #17161 that:
      
      1. are not documented properly, and
      2. don't have specs
      
      This commit addresses the spec absence. For has_many collections,
      
      1. addition (<<) should update the associated object's updated_at (if any)
      2. .clear, depending on options[:dependent], calls delete_all, destroy_all, or nullifies the associated object(s)' foreign key.
      9f48e75a
  22. 23 10月, 2014 1 次提交
  23. 03 10月, 2014 1 次提交
    • B
      Fix that a collection proxy could be cached before the save of the owner,... · cc405496
      Ben Woosley 提交于
      Fix that a collection proxy could be cached before the save of the owner, resulting in an invalid proxy lacking the owner’s id.
      
      Absent this fix calls like: owner.association.update_all to behave unexpectedly because they try to act on association objects where
      owner_id is null.
      
      more evidence here: https://gist.github.com/Empact/5865555
      ```
      Active Record 3.2.13
      -- create_table(:firms, {:force=>true})
         -> 0.1371s
      -- create_table(:clients, {:force=>true})
         -> 0.0005s
      1 clients. 1 expected.
      1 clients updated. 1 expected.
      ```
      
      ```
      Active Record 4.0.0
      -- create_table(:firms, {:force=>true})
         -> 0.1606s
      -- create_table(:clients, {:force=>true})
         -> 0.0004s
      1 clients. 1 expected.
      0 clients updated. 1 expected.
      ```
      cc405496
  24. 06 9月, 2014 1 次提交
  25. 28 8月, 2014 1 次提交
  26. 26 6月, 2014 1 次提交
    • S
      Deprecate automatic counter caches on has_many :through · d730e374
      Sean Griffin 提交于
      Reliant on https://github.com/rails/rails/pull/15747 but pulled to a
      separate PR to reduce noise. `has_many :through` associations have the
      undocumented behavior of automatically detecting counter caches.
      However, the way in which it does so is inconsistent with counter caches
      everywhere else, and doesn't actually work consistently.
      
      As with normal `has_many` associations, the user should specify the
      counter cache on the `belongs_to`, if they'd like it updated.
      d730e374
  27. 16 6月, 2014 1 次提交
    • S
      Always update counter caches in memory when adding records · e6690d37
      Sean Griffin 提交于
      Before, calling `size` would only work if it skipped the cache, and
      would return a different result from the cache, but only if:
      
      - The association was previously loaded
      - Or you called size previously
      - But only if the size was 0 when you called it
      
      This ensures that the counter is appropriately updated in memory.
      e6690d37
  28. 10 6月, 2014 1 次提交
  29. 10 5月, 2014 1 次提交
  30. 04 5月, 2014 2 次提交
  31. 03 5月, 2014 1 次提交
  32. 01 5月, 2014 1 次提交
  33. 29 4月, 2014 1 次提交
    • E
      add test to check that loaded and non laoded are the same · 748daa39
      eileencodes 提交于
      Test checks that SQL is the same for a loaded vs not loaded
      association (category.categorizations, category.categorization.delete_all
      vs category.cartegroization.delete_al). This was fixed for delete_all
      dependency but was not fixed for no (:nullify, or nil) dependency).
      748daa39
  34. 04 4月, 2014 1 次提交
  35. 03 4月, 2014 1 次提交
  36. 01 4月, 2014 1 次提交
  37. 01 3月, 2014 1 次提交
  38. 21 2月, 2014 1 次提交
  39. 09 2月, 2014 1 次提交