aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Formatting CHANGELOGs [ci skip]Ryuta Kamizono2017-08-151-2/+2
| | | | | | Add missing backticks Add missing * Add missing .
* Merge pull request #30169 from awortham/awortham/awortham/fix-sql-distinct-bugRafael Mendonça França2017-08-143-0/+35
|\ | | | | | | Ensure sum honors distinct on has_many through
| * Ensure sum honors distinct on has_many throughAaron Wortham2017-08-143-0/+35
| | | | | | | | | | | | 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-143-8/+18
|\ \ | | | | | | Clarify base_class tests on abstract STI vs concrete STI
| * | Clarify base_class tests on abstract STI vs concrete STIYukio Mizuta2017-08-123-8/+18
| | |
* | | Merge pull request #30073 from yalab/fixture_binary_helperRafael França2017-08-144-1/+14
|\ \ \ | | | | | | | | Add `binary` helper method to fixtures.
| * | | Add `binary` helper method to fixtures.yalab2017-08-124-1/+14
| | | |
* | | | Merge pull request #30208 from kamipo/extract_primary_key_to_abstract_reflectionRafael França2017-08-141-8/+4
|\ \ \ \ | | | | | | | | | | Extract `primary_key` to `AbstractReflection`
| * | | | Extract `primary_key` to `AbstractReflection`Ryuta Kamizono2017-08-121-8/+4
| | |/ / | |/| |
* | | | Merge pull request #27609 from kamipo/fix_association_primary_keyRafael França2017-08-144-21/+25
|\ \ \ \ | | | | | | | | | | Fix `reflection.association_primary_key` for `has_many` association
| * | | | Fix `reflection.association_primary_key` for `has_many` associationsRyuta Kamizono2017-08-134-21/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #30229 from kamipo/allow_serialize_with_custom_coderRafael França2017-08-143-9/+54
|\ \ \ \ \ | | | | | | | | | | | | Allow `serialize` with a custom coder on `json` and `array` columns
| * | | | | Allow `serialize` with a custom coder on `json` and `array` columnsRyuta Kamizono2017-08-133-9/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have a test case for `serialize` with a custom coder in `PostgresqlHstoreTest`. https://github.com/rails/rails/blob/v5.1.3/activerecord/test/cases/adapters/postgresql/hstore_test.rb#L316-L335
* | | | | | Merge pull request #30214 from kirs/uniqueness-scope-validatorRafael França2017-08-142-0/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Check :scope input in Uniqueness validator
| * | | | | | Check :scope input in Uniqueness validatorKir Shatrov2017-08-132-0/+11
| | |_|/ / / | |/| | | |
* | | | | | Merge pull request #30236 from padi/find-each-example-updateRafael França2017-08-141-1/+6
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | Completes ActiveRecord::Batches.find_each example [ci skip]
| * | | | | Completes ActiveRecord::Batches.find_each example [ci skip]Marc Rendl Ignacio2017-08-131-1/+6
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | The previous paragraph mentions that you can hand off the same processing queue to multiple workers. This completes the following example below it.
* | | | | Merge pull request #30231 from kamipo/remove_unused_source_type_infoRafael França2017-08-141-10/+7
|\ \ \ \ \ | | | | | | | | | | | | Remove unused `source_type_info` in `RuntimeReflection`
| * | | | | Remove unused `source_type_info` in `RuntimeReflection`Ryuta Kamizono2017-08-131-10/+7
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | `source_type_info` is only used for `constraints` in `PolymorphicReflection`.
* | | | | Merge pull request #30233 from kamipo/remove_duplicated_join_id_forRafael França2017-08-141-10/+2
|\ \ \ \ \ | | | | | | | | | | | | Remove duplicated `join_id_for`
| * | | | | Remove duplicated `join_id_for`Ryuta Kamizono2017-08-131-10/+2
| |/ / / / | | | | | | | | | | | | | | | The primary key on the owner record is abstracted as `join_foreign_key`.
* | | | | Merge pull request #30206 from yukihirop/improve_activerecord_rdocKasper Timm Hansen2017-08-141-0/+4
|\ \ \ \ \ | | | | | | | | | | | | Add document that you rake test single file by using DB(ex. postgresql)
| * | | | | Add document that you rake test single file by using DB(ex. postgresql) [ci ↵yukihirop2017-08-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | skip]
* | | | | | Fix CI failure due to reference type mismatchRyuta Kamizono2017-08-142-12/+18
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Firm.id` is a bigint if mysql2 adapter is used, but `firm_id` is an integer. It will cause an out of range error. https://travis-ci.org/rails/rails/jobs/264112814#L776 https://travis-ci.org/rails/rails/jobs/264112835#L919
* | | | | Merge pull request #30228 from kamipo/fix_random_ci_failureMatthew Draper2017-08-131-2/+4
|\ \ \ \ \ | | | | | | | | | | | | Fix random CI failure due to non-deterministic sorting order
| * | | | | Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2017-08-131-2/+4
| | |/ / / | |/| | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/263617099#L769-L775
* | | | | Merge pull request #30079 from ↵Matthew Draper2017-08-132-11/+11
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | kamipo/move_test_not_compatible_with_serialize_macro Move `test_not_compatible_with_serialize_macro` to `JSONSharedTestCases`
| * | | | | Move `test_not_compatible_with_serialize_macro` to `JSONSharedTestCases`Ryuta Kamizono2017-08-112-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | Because `JSONSharedTestCases` is also used for `Mysql2JSONTest`.
* | | | | | Delegate to `Enumerable#find` for `CollectionProxy`Ryuta Kamizono2017-08-132-17/+14
| |/ / / / |/| | | | | | | | | | | | | | | | | | | Since `Relation` includes `Enumerable`, it is enough to use `super` simply.
* | | | | Remove duplicated `table_name`Ryuta Kamizono2017-08-121-8/+0
| |_|/ / |/| | | | | | | | | | | It can use `AbstractReflection#table_name` simply.
* | | | Fix outdated comment for `Core::ClassMethods#===` [ci skip] (#30146)Ryuta Kamizono2017-08-121-2/+2
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This comment was added at 97849de, but `AssociationProxy` and `test_triple_equality` was removed at 1644663. Currently the `===` is used for `test_decorated_polymorphic_where` that added at #11945. So I updated "association proxies" to "decorated models". And also, currently `Core::ClassMethods` appears in the doc. http://api.rubyonrails.org/classes/ActiveRecord/Core/ClassMethods.html But it looks like that the methods in the module is not public API. So I also added `# :nodoc:` to the module.
* | | Merge pull request #30126 from ↵Rafael França2017-08-114-12/+26
|\ \ \ | | | | | | | | | | | | | | | | chopraanmol1/support_for_has_many_and_has_one_for_where_relation Fixed query building when relation is passed for has one or has many association in where
| * | | Changed join_fk private method to join_foreign_key public methodchopraanmol12017-08-093-15/+11
| | | |
| * | | Currently if relation object are passed to where condition for has one or ↵chopraanmol12017-08-083-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | has many association wrong set of primary key and foreign key are selected. Changed code to use 'join' primary key and foreign key over 'association' primary key and foreign key.
* | | | 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 #30159 from allcentury/dump-temp-file-permissionsRafael França2017-08-111-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Use copy to preserve file permissions
| * | | | | Use copy to preserve file permissionsAnthony Ross2017-08-091-1/+1
| | | | | |
* | | | | | Merge pull request #29720 from gaurish/ar_find_error_message_improvementRafael França2017-08-114-7/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Return Not found Ids in ActiveRecord::NotFound
| * | | | | | Return Not found Ids in ActiveRecord::NotFoundGaurish Sharma2017-07-294-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This builds on top of 15e2da656f41af0124f7577858536f3b65462ad5. now it also returns exact Ids which were not found which will be debugging simple.
* | | | | | | Merge pull request #30193 from zverok/robust-postgres-duplicate-dbRafael França2017-08-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | More robust PostgreSQL database duplication check
| * | | | | | | Update database duplication checkzverok2017-08-111-1/+1
| | |_|_|_|/ / | |/| | | | |
* | | | | | | Specify `table.name` only when `scope.table` and `table` are different (#29058)Ryuta Kamizono2017-08-112-4/+13
| | | | | | | | | | | | | | | | | | | | | Fixes #29045.
* | | | | | | Fix RDoc formatting: `+` doesn't work with `@`ohbarye2017-08-112-6/+6
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refs: https://github.com/rails/rails/pull/30161 ``` $ echo "+@size+" | rdoc --pipe <p>+@size+</p> $ echo "<tt>@size</tt>" | rdoc --pipe <p><code>@size</code></p> ``` [ci skip]
* | | | | | Merge pull request #30183 from kamipo/reaper_run_after_conn_pool_initializedMatthew Draper2017-08-111-2/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | Start `@reaper.run` after connection pool initialized
| * | | | | | Start `@reaper.run` after connection pool initializedRyuta Kamizono2017-08-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise `ConnectionPool#reap` may run before `@connections` has initialized. https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
* | | | | | | Merge pull request #30152 from bogdanvlviv/fix_random_ci_failureMatthew Draper2017-08-101-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix random CI failure due to non-deterministic sorting order
| * | | | | | | 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 DirtyTest:bogdanvlviv2017-08-091-4/+3
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` rails/activerecord$ bundle exec rake postgresql:test TESTOPTS="--seed=26536" ..(compressed)....F Failure: DirtyTest#test_save_should_not_save_serialized_attribute_with_partial_writes_if_not_present [/home/travis/build/rails/rails/activerecord/test/cases/dirty_test.rb:473]: Expected nil to not be nil. ```
* | | | | | Merge pull request #30108 from yui-knk/require_concurrent_mapRafael França2017-08-081-0/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add missed `require`