aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/preloader
Commit message (Collapse)AuthorAgeFilesLines
* do not reset associations when preloading twice.Yves Senn2013-03-221-2/+1
| | | | | | | | Closes #9806. As the `through_options` always contained `{:order=>nil}` the second time, the preloader ran, the association was always reset. This patch only adds the `:order` to the `through_options` if it is set.
* don't cache invalid subsets when preloading hmt associations.Yves Senn2013-02-191-1/+2
| | | | | | | | | | | | | Backport #9252. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/eager_test.rb The preloader code on 3-2-stable is not based on relations but on option hashes. I had to modify the original patch and comparing the option hashes could be more fuzzy than comparing the relations. All the tests passed though.
* Revert "Merge pull request #9252 from senny/8423_hmt_preloading_bug"Rafael Mendonça França2013-02-151-2/+1
| | | | | | | This reverts commit c5451777b038c5e48567f69256986ae42a2cde48. Conflicts: activerecord/CHANGELOG.md
* Merge pull request #9252 from senny/8423_hmt_preloading_bugRafael Mendonça França2013-02-141-1/+2
| | | | | | | don't cache invalid subsets when preloading hmt associations Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/eager_test.rb
* Ensure association preloading properly merges default scope and association ↵Pratik Naik2012-08-281-3/+1
| | | | | | | | conditions Conflicts: activerecord/test/models/reader.rb
* Restore behavior of Active Record 3.2.3 scopesAndrew White2012-06-011-3/+2
| | | | | | | | | | | | | | A series of commits relating to preloading and scopes caused a regression. Cloning the relation calls initialize_copy which resets a number of instance variables to nil. Without this the scope thinks that it is already loaded when it is called again. Reverts the following commits: 13f1401a6cf0266a3b0a91b173f976db2d4e50f3 8491740ca5361ba9df20e1c8b906c709f5bfbc12 dffbb521a0d00c8673a3ad6e0e8ff526f32daf4e Fixes #6575, #6576 & #6577
* Revert "Revert "Fix #5667. Preloading should ignore scoping.""Benedikt Deicke2012-04-191-2/+3
| | | | | | | | This reverts commit 1166d49f62ccab789be208112163ad13183224e2. Conflicts: activerecord/test/cases/associations/eager_test.rb
* Revert "Fix #5667. Preloading should ignore scoping."Jeremy Kemper2012-04-181-3/+2
| | | | | | | | Causes a subtle regression where record.reload includes the default scope. Hard to reproduce in isolation. Seems like the relation is getting infected by some previous usage. This reverts commit dffbb521a0d00c8673a3ad6e0e8ff526f32daf4e.
* Fix #5667. Preloading should ignore scoping.Jon Leighton2012-03-301-2/+3
| | | | | | Conflicts: activerecord/test/cases/associations/eager_test.rb
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-1/+1
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* reduce calls to owners_by_key and to read_attribute, respond_to? etcAaron Patterson2011-07-011-2/+3
|
* Stop identity-mapping the through records in the preloader since I fixed the ↵Jon Leighton2011-03-041-5/+0
| | | | underlying problem in the habtm preloader.
* When preloading has_and_belongs_to_many associations, we should only ↵Jon Leighton2011-03-041-2/+4
| | | | instantiate one AR object per actual record in the database. (Even when IM is off.)
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-0/+5
|\
* | Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
* Rewrote AssociationPreload.Jon Leighton2011-02-2810-0/+376