aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use order to get the first record since postgresql returns in theRafael Mendonça França2013-02-201-1/+1
| | | | desired order
* keep the build :green_heart:, #first on 1.8.7 and pg is differentYves Senn2013-02-191-1/+1
| | | | | | | | | | | The build only failed for ruby-1.8.7 and pg. The problem was that the statement: ```ruby author = Author.includes(:comments_with_order_and_conditions, :posts).first ``` resulted in Author with ID 2 where on all other rubies / db-engines Author with ID 1 was retunred. Of course this breaks the assertions.
* don't cache invalid subsets when preloading hmt associations.Yves Senn2013-02-191-0/+6
| | | | | | | | | | | | | 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-6/+0
| | | | | | | This reverts commit c5451777b038c5e48567f69256986ae42a2cde48. Conflicts: activerecord/CHANGELOG.md
* Merge pull request #9252 from senny/8423_hmt_preloading_bugRafael Mendonça França2013-02-141-0/+6
| | | | | | | don't cache invalid subsets when preloading hmt associations Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/eager_test.rb
* Remove not used variable in eager testCarlos Antonio da Silva2013-01-071-1/+0
|
* backport #8403, no intermediate AR objects when eager loading.Yves Senn2012-12-041-0/+6
| | | | | | | | | Closes #3313 Conflicts: activerecord/CHANGELOG.md activerecord/test/models/developer.rb
* Revert "backport fair connection pool 02b2335563 to 3-2-stable"Rafael Mendonça França2012-09-201-6/+0
| | | | | | | | | | | | | This reverts commit 0693e079708a52b777f2b7872b8e3d467b880a0d. Revert "Cache columns metadata to avoid extra while testing" This reverts commit a82f1e3f5d11c8dfba9f4c911745ec40a7965216. Reason: This is causing failures in the postgresql build. See http://travis-ci.org/#!/rails/rails/builds/2485584 Related with #7675
* Cache columns metadata to avoid extra while testingRafael Mendonça França2012-09-181-0/+6
|
* Ensure association preloading properly merges default scope and association ↵Pratik Naik2012-08-281-0/+12
| | | | | | | | conditions Conflicts: activerecord/test/models/reader.rb
* Restore behavior of Active Record 3.2.3 scopesAndrew White2012-06-011-24/+0
| | | | | | | | | | | | | | 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
* Add extra order clause to fix failing test on Ruby 1.8.7Carlos Antonio da Silva2012-04-241-1/+1
|
* Adds test to check that circular preloading does not modify Model.unscoped ↵Benedikt Deicke2012-04-191-0/+24
| | | | | | | | (as described in #5667) Conflicts: activerecord/test/cases/associations/eager_test.rb
* Revert "Fix #5667. Preloading should ignore scoping."Jeremy Kemper2012-04-181-11/+0
| | | | | | | | 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-0/+11
| | | | | | Conflicts: activerecord/test/cases/associations/eager_test.rb
* reintroduce patch from #726 to handle nested eager loading via associationsJay Levitt2011-11-301-0/+35
|
* ActiveRecord: Fix eager loading so that giving a blank order clause ↵Elliot Winkler2011-07-181-0/+12
| | | | generates valid SQL
* Foo.joins(:bar).includes(:bar) should result in a single query with :bar as ↵Jon Leighton2011-07-091-0/+8
| | | | a join. Related: #1873.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* fixing test for mysql2Aaron Patterson2011-05-271-5/+2
|
* adding a test for #1322Aaron Patterson2011-05-261-0/+15
|
* Merge pull request #1254 from pixeltrix/ignore-includes-in-through-scopeJon Leighton2011-05-241-0/+6
|\ | | | | Ignore :includes on through associations
| * Ignore :includes on through associationsAndrew White2011-05-241-0/+6
| |
* | Failing tests for #1233.Andrew White2011-05-241-0/+40
|/
* fixing more test warnings in 1.9.3Aaron Patterson2011-04-301-2/+2
|
* Added test case and fix for proper eager loading associationsPavel Forkert2011-04-221-0/+10
|
* When preloading has_and_belongs_to_many associations, we should only ↵Jon Leighton2011-03-041-0/+16
| | | | 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-30/+84
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-281-15/+14
| |
| * Run tests without IdentityMap when IM=false is given.Emilio Tagua2011-02-151-7/+7
| |
| * Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-8/+48
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb
| | * Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-0/+8
| | | | | | | | | | | | ... } rather than instance_eval-ing strings
| | * the connection pool caches table_exists? callsAaron Patterson2011-02-071-0/+2
| | |
| | * When preloading a belongs_to, the target should still be set (to nil) if ↵Jon Leighton2011-01-031-0/+9
| | | | | | | | | | | | there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations.
| | * Allow assignment on has_one :through where the owner is a new record [#5137 ↵Jon Leighton2011-01-031-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state:resolved] This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message!
| | * Some basic tests for the :foreign_type option on belongs_to, which was ↵Jon Leighton2011-01-031-1/+12
| | | | | | | | | | | | previously completely untested.
| | * Fix dodgy tests which were effectively asserting nil == nilJon Leighton2010-12-261-3/+3
| | |
| | * removing SQL interpolation, please use scoping and attribute conditionals as ↵Aaron Patterson2010-12-221-4/+0
| | | | | | | | | | | | a replacement
| * | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2010-12-201-9/+29
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/persistence.rb
| | * Fix problem with duplicated records when a :uniq :through association is ↵Jon Leighton2010-12-151-1/+8
| | | | | | | | | | | | preloaded [#2447 state:resolved]
| | * test for eager load of has_one association with condition on the through tablePivotal Labs2010-12-161-1/+9
| | |
| * | Fix number of queries performed in tests.Emilio Tagua2010-11-191-6/+6
| | |
| * | Revert "IdentityMap - Adjustments to test cases"Emilio Tagua2010-11-191-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4db9dca55e3acc2c59f252eb83ecb83db5f4b81b. Conflicts: activerecord/test/cases/identity_map_test.rb
| * | IdentityMap - Adjustments to test casesMarcin Raczkowski2010-11-191-2/+6
| | |
* | | Merge branch 'master' into nested_has_many_throughJon Leighton2010-12-121-0/+5
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG 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_through_association.rb
| * | preheating cache so that tests can run in isolationAaron Patterson2010-12-091-0/+5
| | |
* | | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-271-0/+52
|\| | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/associations.rb
| * | Removed ids_in_list_limit in favor of in_clause_length defined in ↵Alex Rothenberg2010-11-231-7/+7
| |/ | | | | | | database_limits.rb
| * removing space errorsAaron Patterson2010-11-181-1/+1
| |