aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/cascaded_eager_loading_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Address intermittent CI failure in cascaded_eager_loading_test.rbRyuta Kamizono2019-05-291-12/+12
| | | | https://buildkite.com/rails/rails/builds/61362#99165d42-172d-4ad5-bf72-b29d8cd44f3e/995-1006
* Use `assert_queries(0)` instead of `assert_no_queries` to ignore metadata ↵Yasuo Honda2019-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | queries Fix #35665 ```ruby $ ARCONN=mysql2 bin/test test/cases/scoping/named_scoping_test.rb test/cases/tasks/database_tasks_test.rb test/cases/associations/cascaded_eager_loading_test.rb test/cases/associations/eager_singularization_test.rb -n "/^(?:NamedScopingTest#(?:test_many_should_not_fire_query_if_scope_loaded)|ActiveRecord::DatabaseTasksDumpSchemaCacheTest#(?:test_dump_schema_cache)|CascadedEagerLoadingTest#(?:test_eager_association_loading_with_has_many_sti_and_subclasses)|EagerSingularizationTest#(?:test_eager_no_extra_singularization_has_many_through_belongs_to))$/" --seed 16818 Using mysql2 Run options: -n "/^(?:NamedScopingTest#(?:test_many_should_not_fire_query_if_scope_loaded)|ActiveRecord::DatabaseTasksDumpSchemaCacheTest#(?:test_dump_schema_cache)|CascadedEagerLoadingTest#(?:test_eager_association_loading_with_has_many_sti_and_subclasses)|EagerSingularizationTest#(?:test_eager_no_extra_singularization_has_many_through_belongs_to))$/" --seed 16818 ...F Failure: CascadedEagerLoadingTest#test_eager_association_loading_with_has_many_sti_and_subclasses [/home/yahonda/git/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb:124]: 1 instead of 0 queries were executed. Queries: SHOW FULL FIELDS FROM `topics`. Expected: 0 Actual: 1 bin/test test/cases/associations/cascaded_eager_loading_test.rb:119 Finished in 6.894609s, 0.5802 runs/s, 1.0153 assertions/s. 4 runs, 7 assertions, 1 failures, 0 errors, 0 skips $ ```
* Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2019-02-101-3/+3
| | | | https://travis-ci.org/rails/rails/jobs/491045821#L1528-L1531
* failing test for eager loadingMatt Jones2018-10-041-0/+5
| | | | cherry-picked from https://github.com/rails/rails/pull/33763
* ActiveRecord::Associations::Preloader should not fail to preload through ↵Nikita Sokolov2018-10-021-0/+5
| | | | missing records
* Avoid the same `foreign_key` and `counter_cache` associations on `SillyReply`Ryuta Kamizono2018-09-191-3/+2
| | | | | | | | | `topic` and `reply` belongs_to associations on `SillyReply` are defined with the same `foreign_key` (`parent_id`) and `counter_cache` (`replies_count`) columns. This would cause unintentional side-effect (e.g. saving `SillyReply` object would cause double increment `replies_count`), so it is better to avoid that side-effect.
* Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-121-1/+1
| | | | Follow up of #31390.
* Set counter caches to correct values in fixturesBogdan Gusiev2017-11-081-1/+1
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Remove redundant `assert_nothing_raised` before another assertionsRyuta Kamizono2017-06-061-6/+0
| | | | These `assert_nothing_raised` are covered by following assertions.
* Restore `fixtures :author_addresses`Ryuta Kamizono2017-04-271-1/+1
| | | | | This change reverted in eac6f369 but it is needed for data integrity. See #25328.
* Revert "Merge pull request #27636 from ↵Rafael Mendonça França2017-04-261-1/+1
| | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2" This reverts commit c1faca6333abe4b938b98fedc8d1f47b88209ecf, reversing changes made to 8c658a0ecc7f2b5fc015d424baf9edf6f3eb2b0b. See https://github.com/rails/rails/pull/27636#issuecomment-297534129
* Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2017-03-261-1/+1
| | | | | | | | | | | | | | | privileges (take 2) Re-create https://github.com/rails/rails/pull/21233 eeac6151a5 was reverted (127509c071b4) because it breaks tests. ---------------- ref: 72c1557254 - We must use `authors` fixture with `author_addresses` because of its foreign key constraint. - Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
* Revert "Merge pull request #21233 from ↵Rafael Mendonça França2017-01-031-1/+1
| | | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privileges" This reverts commit eeac6151a55cb7d5f799e1ae33aa64a839cbc3aa, reversing changes made to 5c40239d3104543e70508360d27584a3e4dc5baf. Reason: Broke the isolated tests. https://travis-ci.org/rails/rails/builds/188721346
* Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2016-12-031-1/+1
| | | | | | | | | privileges ref: 72c1557254 - We must use `authors` fixture with `author_addresses` because of its foreign key constraint. - Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-4/+4
|
* improve error message when include assertions failMichael Grosser2016-09-161-2/+2
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add three new rubocop rulesRafael Mendonça França2016-08-161-16/+16
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* modernizes hash syntax in activerecordXavier Noria2016-08-061-22/+22
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-21/+21
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Deprecate automatic counter caches on has_many :throughSean Griffin2014-06-261-2/+2
| | | | | | | | | | | 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.
* Improve the tests to not call assert_nothing_raisedRafael Mendonça França2014-01-011-4/+1
|
* https://github.com/rails/rails/commit/2075f39d726cef361170218fd16421fc52bed5 ↵Vipul A M2013-12-311-0/+14
| | | | | | | | | | | | | | | | | a8 introduced a regression in includes/preloades by calling `read_attribute` on an association when preloading takes places, instead of using loaded records in `association.target`. tl;dr Records are not made properly available via `read_attribute` when preloding in simultaneous, but value of `@loaded` is already set true, and records concatenated in `association.target` on an association object. When `@loaded` is true we return an object of `AlreadyLoaded` in preload_for. In `AlreadyLoaded` to return preloaded records we make wrong use of `read_attribute`, instead of `target` records. The regression is fixed by making use of the loaded records in `association.target` when the preloading takes place. Fixes #13437
* query the association rather than send the method for the association nameAaron Patterson2013-08-271-6/+4
|
* Deprecate the `:distinct` option for `Relation#count`.Yves Senn2013-03-151-1/+1
| | | | | | | We moved more and more away from passing options to finder / calculation methods. The `:distinct` option in `#count` was one of the remaining places. Since we can now combine `Relation#distinct` with `Relation#count` the option is no longer necessary and can be deprecated.
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-14/+14
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-19/+19
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* find and replace deprecated keysJon Leighton2012-04-271-14/+14
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-14/+14
| | | | things
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-3/+3
| | | | | | See the CHANGELOG for details. Fixes #950.
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-26/+6
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-6/+26
|
* 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.
* Opening class CascadedEagerLoadingTest at once.Arun Agrawal2011-05-311-7/+3
|
* Bug fixes:Fadzril Muhamad & Joseph Palermo2011-05-121-1/+3
| | | | | | - If doing a count on a relation that has an :include and a :join, it does a distinct even though it should not. - When doing a count on a relation that has an :include, it always falls back to a old style left join when performing the count. Looks like it was broken here: https://github.com/rails/rails/commit/b9599502c9e738a5a1513e75d08f8d40ed408265
* Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-081-1/+1
|\ | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * Fixes queries using limits and punctuation in order, removes order("col1, ↵Santiago Pastorino2010-11-051-1/+1
| | | | | | | | | | | | col2") usage in favor of order(["col1", "col2"}) [#4597 state:committed]
* | Update new tests in cascaded_eager_loading_test.rb to work with the modified ↵Jon Leighton2010-10-311-6/+6
| | | | | | | | fixtures in this branch
* | Fix bug with 0bb85ed9ffa9808926b46e8f7e59cab5b85ac19f which missed out a ↵Jon Leighton2010-10-311-1/+2
| | | | | | | | fixtures declaration in cascaded_eager_loading_test.rb
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-311-0/+26
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/through_association_scope.rb
| * Fix issues when including the same association multiple times and mixing ↵Ernie Miller2010-10-301-0/+26
| | | | | | | | joins/includes together.
| * Add some tests for functionality in JoinAssociation which already exists but ↵Jon Leighton2010-10-131-4/+4
| | | | | | | | was previously untested
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-3/+3
| | | | | | | | through association
* | Refactoring JoinDependency and friends. This improves the code (IMO) ↵Jon Leighton2010-10-061-4/+4
| | | | | | | | including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered.
* | Fix the tests (I have actually verified that these are also the 'right' ↵Jon Leighton2010-10-031-9/+9
|/ | | | fixes, rather than just making the tests pass again)
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-1/+0
| | | | | | [#5153 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* fixing typeo. thanks bamnet!Aaron Patterson2010-07-161-1/+1
|