aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Move `test_index_is_created_for_both_timestamps` to ↵Yasuo Honda2017-08-171-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `TimestampsWithoutTransactionTest` This commit addresses these failures when the backend RDBMS executes implicit commit for DDL like MySQL and Oracle. ```ruby $ ARCONN=mysql2 bin/test test/cases/integration_test.rb test/cases/timestamp_test.rb --seed 58225 -n '/^(?:TimestampTest#(?:test_index_is_created_for_both_timestamps)|IntegrationTest#(?:test_cache_key_for_newer_updated_at|test_cache_key_format_for_existing_record_with_updated_at|test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format))$/' -v Using mysql2 Run options: --seed 58225 -n "/^(?:TimestampTest#(?:test_index_is_created_for_both_timestamps)|IntegrationTest#(?:test_cache_key_for_newer_updated_at|test_cache_key_format_for_existing_record_with_updated_at|test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format))$/" -v TimestampTest#test_index_is_created_for_both_timestamps = 0.19 s = . IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at = 0.05 s = F IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format = 0.02 s = F IntegrationTest#test_cache_key_for_newer_updated_at = 0.01 s = F Finished in 0.272880s, 14.6585 runs/s, 14.6585 assertions/s. 1) Failure: IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:111]: --- expected +++ actual @@ -1 +1 @@ -"developers/1-20170717135609430848" +"developers/1-20170817135609283207" 2) Failure: IntegrationTest#test_cache_key_format_for_existing_record_with_updated_at_and_custom_cache_timestamp_format [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:116]: --- expected +++ actual @@ -1 +1 @@ -"cached_developers/1-20170717135609" +"cached_developers/1-20170817135609" 3) Failure: IntegrationTest#test_cache_key_for_newer_updated_at [/home/yahonda/git/rails/activerecord/test/cases/integration_test.rb:147]: --- expected +++ actual @@ -1 +1 @@ -"developers/1-20170717145609430848" +"developers/1-20170817135609283207" 4 runs, 4 assertions, 3 failures, 0 errors, 0 skips $ ``` `ActiveRecord::TestCase::TimestampTest#test_index_is_created_for_both_timestamps` calls`ActiveRecord::TestCase::TimestampTest#setup` which updates `updated_at` column value. ```ruby @developer = Developer.first ... snip ... @developer.update_columns(updated_at: Time.now.prev_month) ``` This transaction expected to be rolled back, but if the backend RDBMS like MySQL perfomes implicit commit when DDL executed, this transacion is committed by `create table` statement inside `ActiveRecord::TestCase::TimestampTest#test_index_is_created_for_both_timestamps`. It causes these failures above which expect `update_at` column value are not changed(rollbacked).
* Merge pull request #30048 from yahonda/regexp_aware_schema_dumper_prefix_suffixRafael França2017-08-162-1/+28
|\ | | | | Allow `table_name_prefix` and `table_name_suffix` have `$`
| * Allow `table_name_prefix` and `table_name_suffix` have `$`Yasuo Honda2017-08-042-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MySQL 5.7 and PostgreSQL 9.6 allow table identifiers have the dollar sign. * MySQL 5.7 https://dev.mysql.com/doc/refman/5.7/en/identifiers.html > Permitted characters in unquoted identifiers: > ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) * PostgreSQL 9.6 https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html > SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($). Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable. The SQL standard will not define a key word that contains digits or starts or ends with an underscore, so identifiers of this form are safe against possible conflict with future extensions of the standard. Address #30044 [Yasuo Honda & Ryuta Kamizono]
* | Add spaceJon Moss2017-08-161-1/+1
| | | | | | | | [ci skip]
* | Merge pull request #30210 from koic/fix_rubocop_offensesMatthew Draper2017-08-162-6/+7
|\ \ | | | | | | Fix RuboCop offenses
| * | Fix RuboCop offensesKoichi ITO2017-08-162-6/+7
| | | | | | | | | | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* | | Fix test "_before_type_cast" for enum (#29004)Ryuta Kamizono2017-08-161-6/+8
|/ / | | | | Since c51f9b61 changed the "_before_type_cast" expectation for enum.
* | Merge pull request #30271 from ↵Rafael França2017-08-155-19/+33
|\ \ | | | | | | | | | | | | kamipo/through_scope_should_not_be_affected_by_scoping Through scope should not be affected by scoping
| * | Through scope should not be affected by scopingRyuta Kamizono2017-08-155-19/+33
| | | | | | | | | | | | | | | | | | Follow up of #29834. Fixes #30266.
* | | Don't expose `write_attribute_without_type_cast`Ryuta Kamizono2017-08-161-6/+5
|/ / | | | | | | | | | | `write_attribute_without_type_cast` is defined as a private method in `AttributeMethods::Write`, but `AttributeMethods::Dirty` overrode it as a public method. It should be kept the original visibility.
* | 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.