1. 09 2月, 2019 1 次提交
    • G
      Clarify collection proxy docs · 7354d71f
      Gannon McGibbon 提交于
      The docs for `ActiveRecord::Associations::CollectionProxy` describe
      `ActiveRecord::Associations::Association`. I've moved them to
      association and rewrote collection proxy's docs to be more applicable to
      what the class actually does.`
      
      [ci skip]
      7354d71f
  2. 06 2月, 2019 1 次提交
  3. 04 12月, 2018 1 次提交
  4. 18 10月, 2018 1 次提交
  5. 10 10月, 2018 1 次提交
  6. 07 2月, 2018 2 次提交
  7. 25 1月, 2018 1 次提交
    • D
      Avoid passing unnecessary arguments to relation · 6928950d
      Daniel Colson 提交于
      Most of the time the table and predicate_builder
      passed to Relation.new are exactly the
      arel_table and predicate builder of the
      given klass. This uses klass.arel_table
      and klass.predicate_builder as the defaults,
      so we don't have to pass them in most cases.
      
      This does change the signaure of both Relation and
      AssocationRelation. Are we ok with that?
      6928950d
  8. 10 11月, 2017 1 次提交
  9. 16 10月, 2017 1 次提交
  10. 13 8月, 2017 1 次提交
  11. 20 7月, 2017 1 次提交
  12. 02 7月, 2017 1 次提交
  13. 01 7月, 2017 1 次提交
  14. 22 6月, 2017 1 次提交
  15. 21 6月, 2017 1 次提交
    • J
      Clear offset cache on CollectionProxy reset/reload · c7f669af
      John Hawthorn 提交于
      The `@offsets` cache is used by FinderMethods to cache records found by
      find_nth. This cache is cleared in AR::Relation#reset, but not in
      CollectionProxy#reset or CollectionProxy#reload.
      
      Because of this, since #29098, calling #first/#find_nth/etc after
      calling #reload or #reset on an association could return a stale record.
      This is an issue both when the full association target is loaded and
      when the item is loaded in #find_nth.
      
      This commit solves the problem by clearing the `@offsets` cache in
      CollectionProxy#reset and CollectionProxy#reload.
      c7f669af
  16. 28 5月, 2017 2 次提交
  17. 22 4月, 2017 1 次提交
  18. 23 3月, 2017 1 次提交
  19. 20 3月, 2017 1 次提交
  20. 09 3月, 2017 1 次提交
  21. 01 3月, 2017 1 次提交
  22. 28 2月, 2017 1 次提交
    • E
      Dupping a CollectionProxy should dup the load_target · ca8c21df
      eileencodes 提交于
      In Rails 3.2 dupping a `CollectionProxy` would dup it's `load_target` as
      well. That functionality has been broken since the release of Rails 4.0.
      I hit this in an application upgrade and wondered why duplicating a
      CollectionProxy and assigning it to a variable stopped working.
      
      When calling `dup` on a `CollectionProxy` only the owner (ex.
      topic) was getting duplicated and the `load_target` would remain in tact
      with it's original object ID. Dupping the `load_target` is useful for performing
      a logging operation after records have been destroyed in a method.
      
      For example:
      
      ```
      def transfer_operation
        saved_replies = topic.replies
      
        topic.replies.clear
      
        saved_replies.each do |reply|
          user.update_replies_count!
        end
      end
      ```
      
      This change adds a `initialize_dup` method that performs a `deep_dup` on
      the `@associatiation` so that the `load_target` is dupped as well.
      
      Fixes #17117
      ca8c21df
  23. 21 2月, 2017 1 次提交
  24. 29 12月, 2016 1 次提交
  25. 25 12月, 2016 2 次提交
  26. 24 12月, 2016 1 次提交
  27. 13 11月, 2016 1 次提交
    • R
      Respect new records for `CollectionProxy#uniq` · 0ec967aa
      Ryuta Kamizono 提交于
      Currently if `CollectionProxy` has more than one new record,
      `CollectionProxy#uniq` result is incorrect.
      
      And `CollectionProxy#uniq` was aliased to `distinct` in a1bb6c8b.
      But the `uniq` method and the `SELECT DISTINCT` method are different
      methods. The doc in `CollectionProxy` is for the `SELECT DISTINCT`
      method, not for the `uniq` method.
      
      Therefore, reverting the alias in `CollectionProxy` to fix the
      inconsistency and to have the both methods.
      0ec967aa
  28. 22 10月, 2016 1 次提交
  29. 07 9月, 2016 2 次提交
  30. 04 9月, 2016 1 次提交
  31. 19 8月, 2016 2 次提交
  32. 18 8月, 2016 2 次提交
  33. 16 8月, 2016 1 次提交
  34. 14 8月, 2016 1 次提交