aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Load both `:authors` and `:author_addresses` to keep data integrityYasuo Honda2017-08-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `:authors` has a foreign key to `:author_addresses`. If only `:authors` fixture loaded into the database which supports foreign key and checks the existing data when enabling foreien keys like Oracle, it raises the following error `ORA-02298: cannot validate (ARUNIT.FK_RAILS_94423A17A3) - parent keys not found` It is because there is no parent data exists in `author_addresses` table. Here are how other database with foreign key support works: - MySQL does not check the existing data when enabling foreign key by `foreign_key_checks=1` https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_foreign_key_checks > Setting foreign_key_checks to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while foreign_key_checks=0 will not be verified for consistency. - PostgreSQL database itself has a feature to check existing data when enabling foreign key and discussed at #27636, which is reverted.
* | | | Automatically guess the inverse associations for STIyui-knk2017-08-221-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord associations automatically guess the inverse associations. But this feature does not work correctly on assoctions for STI. For example, before this commit ``` class Post < ActiveRecord::Base belongs_to :author end class SpecialPost < Post; end class Author < ActiveRecord::Base has_many :posts has_many :special_posts end ``` `author.posts.first.author` works correctly, but `author.special_posts.first.author` does not work correctly.
* | | | Add deterministic sorting order for `test_taking_with_a_number`Ryuta Kamizono2017-08-181-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise random CI failure will be caused. https://travis-ci.org/rails/rails/jobs/265848046#L777
* | | | Through scope should not be affected by scopingRyuta Kamizono2017-08-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Follow up of #29834. Fixes #30266.
* | | | Merge pull request #30169 from awortham/awortham/awortham/fix-sql-distinct-bugRafael Mendonça França2017-08-141-0/+26
|\ \ \ \ | | | | | | | | | | | | | | | Ensure sum honors distinct on has_many through
| * | | | Ensure sum honors distinct on has_many throughAaron Wortham2017-08-141-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using a has_many through relation and then summing an attribute the distinct was not being used. This will ensure that when summing an attribute, the number is only used once when distinct has been used.
* | | | | Merge pull request #30215 from untidy-hair/clarify-abstract-or-not-in-testsRafael França2017-08-141-3/+3
|\ \ \ \ \ | | | | | | | | | | | | Clarify base_class tests on abstract STI vs concrete STI
| * | | | | Clarify base_class tests on abstract STI vs concrete STIYukio Mizuta2017-08-121-3/+3
| |/ / / /
* / / / / Fix `reflection.association_primary_key` for `has_many` associationsRyuta Kamizono2017-08-132-17/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is incorrect to treat `options[:primary_key]` as `association_primary_key` if `has_many` associations because the `:primary_key` means the column on the owner record, not on the association record. It will break `ids_reader` and `ids_writer`. ```ruby people(:david).essay_ids # => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David' ``` Fixes #14439.
* | | | Merge pull request #30103 from yahonda/has_one_associations_failuresRafael França2017-08-111-1/+1
|\ \ \ \ | | | | | | | | | | Add `:authors` to address random failures at HasOneAssociationsTest
| * | | | Add `:authors` fixture to address two random failures at HasOneAssociationsTestYasuo Honda2017-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sqlite3 - 2 failures ```ruby $ ARCONN=sqlite3 bin/test test/cases/associations/has_one_associations_test.rb test/cases/view_test.rb --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose Using sqlite3 Run options: --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose ViewWithoutPrimaryKeyTest#test_attributes = 0.02 s = . HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_replace = 0.12 s = F HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy = 0.01 s = F Finished in 0.162504s, 18.4610 runs/s, 18.4610 assertions/s. 1) Failure: HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_replace [/home/yahonda/git/rails/activerecord/test/cases/associations/has_one_associations_test.rb:725]: Expected true to be nil or false 2) Failure: HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy [/home/yahonda/git/rails/activerecord/test/cases/associations/has_one_associations_test.rb:715]: Expected true to be nil or false 3 runs, 3 assertions, 2 failures, 0 errors, 0 skips ``` * mysql2 - 1 failure ``` $ ARCONN=mysql2 bin/test test/cases/associations/has_one_associations_test.rb test/cases/view_test.rb --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose Using mysql2 Run options: --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose ViewWithoutPrimaryKeyTest#test_attributes = 0.07 s = . HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_replace = 0.27 s = F HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy = 0.02 s = . Finished in 0.362779s, 8.2695 runs/s, 8.2695 assertions/s. 1) Failure: HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_replace [/home/yahonda/git/rails/activerecord/test/cases/associations/has_one_associations_test.rb:725]: Expected true to be nil or false 3 runs, 3 assertions, 1 failures, 0 errors, 0 skips ``` * postgresql - 0 failures ```ruby $ ARCONN=postgresql bin/test test/cases/associations/has_one_associations_test.rb test/cases/view_test.rb --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose Using postgresql Run options: --seed 48032 -n "/^(?:ViewWithoutPrimaryKeyTest#(?:test_attributes)|HasOneAssociationsTest#(?:test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy|test_destroyed_by_association_set_in_child_destroy_callback_on_replace))$/" --verbose ViewWithoutPrimaryKeyTest#test_attributes = 0.06 s = . HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_parent_destroy = 0.22 s = . HasOneAssociationsTest#test_destroyed_by_association_set_in_child_destroy_callback_on_replace = 0.02 s = . Finished in 0.311217s, 9.6396 runs/s, 9.6396 assertions/s. 3 runs, 3 assertions, 0 failures, 0 errors, 0 skips ```
* | | | | Merge pull request #29720 from gaurish/ar_find_error_message_improvementRafael França2017-08-111-2/+4
|\ \ \ \ \ | | | | | | | | | | | | Return Not found Ids in ActiveRecord::NotFound
| * | | | | Return Not found Ids in ActiveRecord::NotFoundGaurish Sharma2017-07-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This builds on top of 15e2da656f41af0124f7577858536f3b65462ad5. now it also returns exact Ids which were not found which will be debugging simple.
* | | | | | Fix random CI failure due to non-deterministic sorting orderbogdanvlviv2017-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` rails/activerecord$ bundle exec rake postgresql:test --verbose TESTOPTS="--seed=36062" Failure: AssociationsJoinModelTest#test_has_many_through_polymorphic_has_one [/home/travis/build/rails/rails/activerecord/test/cases/associations/join_model_test.rb:407]: --- expected +++ actual @@ -1 +1 @@ -[ #<Tagging id: 1, tag_id: 1, super_tag_id: 2, taggable_type: "Post", taggable_id: 1, comment: nil>, #<Tagging id: 2, tag_id: 1, super_tag_id: nil, taggable_type: "Post", taggable_id: 2, comment: nil> ] +#<ActiveRecord::Associations::CollectionProxy [ #<Tagging id: 2, tag_id: 1, super_tag_id: nil, taggable_type: "Post", taggable_id: 2, comment: nil>, #<Tagging id: 1, tag_id: 1, super_tag_id: 2, taggable_type: "Post", taggable_id: 1, comment: nil> ]> ```
* | | | | | Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2017-08-081-1/+1
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be sorted to be deterministic executed result. ``` % bundle exec rake test_postgresql --verbose TESTOPTS="--seed=52812" (snip) Failure: HasManyThroughAssociationsTest#test_has_many_association_through_a_has_many_association_to_self [/Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb:820]: --- expected +++ actual @@ -1 +1 @@ -[#<Person id: 85, primary_contact_id: 84, gender: "M", number1_fan_id: 1, lock_version: 0, comments: nil, followers_count: 0, friends_too_count: 0, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:52", updated_at: "2017-08-08 07:33:52", first_name: "John">, #<Person id: 1, primary_contact_id: 2, gender: "M", number1_fan_id: 3, lock_version: 0, comments: nil, followers_count: 1, friends_too_count: 1, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:49", updated_at: "2017-08-08 07:33:49", first_name: "Michael">, #<Person id: 3, primary_contact_id: 2, gender: "F", number1_fan_id: 1, lock_version: 0, comments: nil, followers_count: 1, friends_too_count: 1, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:49", updated_at: "2017-08-08 07:33:49", first_name: "Susan">] +#<ActiveRecord::Associations::CollectionProxy [#<Person id: 1, primary_contact_id: 2, gender: "M", number1_fan_id: 3, lock_version: 0, comments: nil, followers_count: 1, friends_too_count: 1, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:49", updated_at: "2017-08-08 07:33:49", first_name: "Michael">, #<Person id: 3, primary_contact_id: 2, gender: "F", number1_fan_id: 1, lock_version: 0, comments: nil, followers_count: 1, friends_too_count: 1, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:49", updated_at: "2017-08-08 07:33:49", first_name: "Susan">, #<Person id: 85, primary_contact_id: 84, gender: "M", number1_fan_id: 1, lock_version: 0, comments: nil, followers_count: 0, friends_too_count: 0, best_friend_id: nil, best_friend_of_id: nil, insures: 0, born_at: nil, created_at: "2017-08-08 07:33:52", updated_at: "2017-08-08 07:33:52", first_name: "John">]> ```
* | | | | Merge remote-tracking branch 'origin/master' into unlock-minitestRafael Mendonça França2017-08-0121-47/+120
|\| | | |
| * | | | Fix `warning: assigned but unused variable - comment`Ryuta Kamizono2017-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` % ARCONN=sqlite3 be ruby -w -Itest test/cases/associations/belongs_to_associations_test.rb -n test_multiple_counter_cache_with_after_create_update test/cases/associations/belongs_to_associations_test.rb:1181: warning: assigned but unused variable - comment Using sqlite3 Run options: -n test_multiple_counter_cache_with_after_create_update --seed 49644 . Finished in 0.114266s, 8.7515 runs/s, 17.5030 assertions/s. 1 runs, 2 assertions, 0 failures, 0 errors, 0 skips ```
| * | | | Merge pull request #29765 from lugray/fix_counter_cacheRafael França2017-07-241-0/+11
| |\ \ \ \ | | | | | | | | | | | | Fix `counter_cache` double increment
| | * | | | Add test for fixed `counter_cache` double incrementLisa Ugray2017-07-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an `after_create` callback did `update_attributes` on a record with multiple `belongs_to` associations with counter caches, even numbered associations would have their counters double-incremented. Fixes to `ActiveModel::Dirty` in 020abad fixed this. This adds regression tests for this bug fixed incidentally in the other commit, which also removed the need for the workaround using @_after_create_counter_called.
| * | | | | Refactor Active Record to let Arel manage bind paramsSean Griffin2017-07-241-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common source of bugs and code bloat within Active Record has been the need for us to maintain the list of bind values separately from the AST they're associated with. This makes any sort of AST manipulation incredibly difficult, as any time we want to potentially insert or remove an AST node, we need to traverse the entire tree to find where the associated bind parameters are. With this change, the bind parameters now live on the AST directly. Active Record does not need to know or care about them until the final AST traversal for SQL construction. Rather than returning just the SQL, the Arel collector will now return both the SQL and the bind parameters. At this point the connection adapter will have all the values that it had before. A bit of this code is janky and something I'd like to refactor later. In particular, I don't like how we're handling associations in the predicate builder, the special casing of `StatementCache::Substitute` in `QueryAttribute`, or generally how we're handling bind value replacement in the statement cache when prepared statements are disabled. This also mostly reverts #26378, as it moved all the code into a location that I wanted to delete. /cc @metaskills @yahonda, this change will affect the adapters Fixes #29766. Fixes #29804. Fixes #26541. Close #28539. Close #24769. Close #26468. Close #26202. There are probably other issues/PRs that can be closed because of this commit, but that's all I could find on the first few pages.
| * | | | | Merge pull request #29855 from lugray/has_one_destroyed_by_associationRafael França2017-07-211-0/+34
| |\ \ \ \ \ | | | | | | | | | | | | | | Match destroyed_by_association for has_one to has_many
| | * | | | | Match destroyed_by_association for has_one to has_manyLisa Ugray2017-07-211-0/+34
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a has_many association is destroyed by `dependent: destroy`, destroyed_by_association is set to the reflection, and this can be checked in callbacks. This matches that behaviour for has_one associations.
| * | | | | Reset column information after schema changedyuuji.yaginuma2017-07-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following failures. https://travis-ci.org/rails/rails/jobs/253990014
| * | | | | Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-1921-0/+42
| |/ / / /
| * | | | Merge pull request #29679 from kamipo/add_test_case_for_27724Kasper Timm Hansen2017-07-151-0/+7
| |\ \ \ \ | | | | | | | | | | | | Add a test case for overwriting existing condition on associations
| | * | | | Add a test case for overwriting existing condition on associationsRyuta Kamizono2017-07-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overwriting existing condition on associations has already supported (23bcc65 for eager loading, 2bfa2c0 for preloading). Fixes #27724. Closes #29154.
| * | | | | Remove extra `.merge!(order: "id")` for `Relation#first` in testsRyuta Kamizono2017-07-132-32/+28
| |/ / / / | | | | | | | | | | | | | | | | | | | | Since 07e5301, `Relation#first` will order by primary key if no order is defined.
* | | | | Reset column information after schema changedyuuji.yaginuma2017-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following failures. https://travis-ci.org/rails/rails/jobs/253990014
* | | | | Merge branch 'master' into unlock-minitestKasper Timm Hansen2017-07-159-56/+102
|\| | | |
| * | | | Fix eager loading association with scope including joinsRyuta Kamizono2017-07-041-0/+1
| | | | | | | | | | | | | | | | | | | | Fixes #28324.
| * | | | Fix preloading association with scope including joinsRyuta Kamizono2017-07-041-0/+4
| | | | |
| * | | | Remove redundant `assert_respond_to`Ryuta Kamizono2017-07-031-26/+0
| | | | | | | | | | | | | | | | | | | | It is covered by following assertion.
| * | | | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0221-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * | | | Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0221-0/+21
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Enforce frozen string in Rubocop
| | * | | | Enforce frozen string in RubocopKir Shatrov2017-07-0121-0/+21
| | | | | |
| * | | | | Merge pull request #29631 from kamipo/should_be_clear_association_idsMatthew Draper2017-07-011-0/+5
| |\ \ \ \ \ | | | | | | | | | | | | | | Should be clear `@association_ids` when joined newly associated record
| | * | | | | Should be clear `@association_ids` when joined newly associated recordRyuta Kamizono2017-06-301-0/+5
| | |/ / / / | | | | | | | | | | | | | | | | | | Fixes #29627.
| * | | | | Merge pull request #28808 from fschwahn/fix-polymorphic-automic-inverseMatthew Draper2017-07-012-6/+16
| |\ \ \ \ \ | | |/ / / / | |/| | | | Fix automatic inverse for polymorphic interfaces
| | * | | | Add regression test for setting inverse instances on normal & polymorphic ↵Fabian Schwahn2017-04-201-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | relationships when building objects on new records
| | * | | | Remove :polymorphic from INVALID_AUTOMATIC_INVERSE_OPTIONSFabian Schwahn2017-04-201-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes automatic inverse detection possible for polymorphic :has_one & :has_many possible. This resolves a number of issues, eg. `touch: true` on polymorphic relationships (#16446) and automatically setting inverse associations on newly built objects (#15028, #21843).
| * | | | | Remove unused `aliased_table_name` in `Association`Ryuta Kamizono2017-06-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `aliased_table_name` in `Association` was added at a3502c4. `aliased_table_name` in `JoinDependency` (added at 55854c4) is used, but it looks like that added one in `Association` is never used from the beginning.
| * | | | | Merge pull request #29601 from ↵Rafael Mendonça França2017-06-281-10/+17
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/fix_eager_loading_to_respect_store_full_sti_class Fix eager loading to respect `store_full_sti_class` setting
| | * | | | | Fix eager loading to respect `store_full_sti_class` settingRyuta Kamizono2017-06-291-10/+17
| | | | | | |
| * | | | | | Merge pull request #29610 from ↵Rafael França2017-06-281-2/+1
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kamipo/dont_passing_klass_connection_to_association_scope Don't passing `klass.connection` to `AssociationScope`
| | * | | | | | Don't passing `klass.connection` to `AssociationScope`Ryuta Kamizono2017-06-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing `klass.connection` is redundant because `AssociationScope` is passed an association itself and an association has `klass`.
| * | | | | | | Merge pull request #29611 from kamipo/add_test_case_for_unscoping_default_scopeRafael França2017-06-281-2/+3
| |\ \ \ \ \ \ \ | | |_|/ / / / / | |/| | | | | | Add a test case for unscoping `default_scope` in associations
| | * | | | | | Add a test case for unscoping `default_scope` in associationsRyuta Kamizono2017-06-291-2/+3
| | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unscoping `default_scope` in associations has already supported (#17360 for preloading, c9cf8b8 for eager loading). Fixes #20679. Closes #16531.
| * | | | | | Merge pull request #29602 from kamipo/use_reload_in_test_find_first_after_reloadRafael França2017-06-281-10/+10
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | | Use `reload` in `test_find_first_after_reload`
| | * | | | | Use `reload` in `test_find_first_after_reload`Ryuta Kamizono2017-06-281-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And use `assert_same` instead of `assert_equal` and tiny fix assert message s/#reload/#reset/. Follow up of #29511.
| * | | | | | ActiveRecord: do not create "has many through" records that have been removedTobias Kraze2017-06-281-0/+11
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | If a record was built on a HasManyThroughAssociation, then removed, and then the record was saved, the removed record would be created anyways.