aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* 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`
| * | | | | Add missed `require`yui-knk2017-08-071-0/+2
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | `ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration` depends on `Concurrent::Map`.
* | | | | Merge pull request #30142 from ↵Sean Griffin2017-08-081-4/+12
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | yukideluxe/add-missing-bit-reload-associations-docs add missing collection.reload documentation [ci skip]
| * | | | | add missing collection.reload documentation [ci skip]Julia López2017-08-081-4/+12
| | | | | |
* | | | | | Merge pull request #30133 from kamipo/fix_random_ci_failureRafael França2017-08-081-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix random CI failure due to non-deterministic sorting order
| * | | | | | 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">]> ```
* | | | | | Document `ActiveRecord::AttributeMethods::Dirty`Sean Griffin2017-08-081-9/+9
| |/ / / / |/| | | | | | | | | | | | | | | | | | | This module has behavior that is not present in `ActiveModel::Dirty`, which is intended to be public API.
* | | | | Merge pull request #30125 from yukideluxe/add-reload-to-associations-docsRafael França2017-08-081-0/+8
|\ \ \ \ \ | |_|_|/ / |/| | | | add reload_association to documentation
| * | | | add reload_association to documentation [ci skip]Julia López2017-08-071-0/+8
| |/ / /
* / / / [ci skip] Postgres --> PostgreSQLRyuta Kamizono2017-08-083-3/+3
|/ / /
* | / Lint activerecord/CHANGELOG.mdJon Moss2017-08-061-4/+4
| |/ |/| | | | | | | | | Light grammar fixes, and added a few backticks. [ci skip]
* | Merge pull request #29520 from kirs/serialize-vs-postgres-native-columnSean Griffin2017-08-043-0/+42
|\ \ | | | | | | Do not let use `serialize` on native JSON/array column
| * | Do not let use `serialize` on native JSON/array columnKir Shatrov2017-08-043-0/+42
| |/
* | Use `Concurrent::Map` than `Mutex` and `Mutex_m` for statement cachesRyuta Kamizono2017-08-042-10/+6
| | | | | | | | | | Statement caches are used as a concurrent map. It will more clarify to using `Concurrent::Map`.
* | Fix all rubocop violationsRafael Mendonça França2017-08-031-2/+2
| |
* | Passing `klass` to `StatementCache.new`Ryuta Kamizono2017-08-046-32/+31
| | | | | | | | | | | | Actually `StatementCache#execute` is always passed the same klass that the owner klass of the connection when the statement cache is created. So passing `klass` to `StatementCache.new` will make more DRY.
* | Merge pull request #30011 from guilherme/fix-migration-generator-special-casesSean Griffin2017-08-031-1/+1
|\ \ | | | | | | Handling add/remove to/from migration edge cases
| * | Handling add/remove to/from migration edge casesGuilherme Reis Campos2017-08-031-1/+1
| | | | | | | | | | | | Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
* | | Merge pull request #29914 from ↵Matthew Draper2017-08-023-19/+30
|\ \ \ | | | | | | | | | | | | | | | | kamipo/relation_merger_should_not_fill_empty_values `Relation::Merger` should not fill `values` with empty values
| * | | `get_value` and `set_value` in `Relation` are no longer used externallyRyuta Kamizono2017-07-251-9/+10
| | | |
| * | | `Relation::Merger` should not fill `values` with empty valuesRyuta Kamizono2017-07-252-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `Relation#merge` will almost fill `values` with empty values (e.g. `other.order_values` is always true, it should be `other.order_values.any?`). This means that `Relation#merge` always changes `values` even if actually `values` is nothing changed. This behavior will makes `Relation#empty_scope?` fragile. So `Relation#merge` should avoid unnecessary changes.
* | | | Merge pull request #29842 from kamipo/fix_find_by_with_rangeMatthew Draper2017-08-023-4/+12
|\ \ \ \ | | | | | | | | | | Fix `find_by` with range conditions
| * | | | Fix `find_by` with range conditionsRyuta Kamizono2017-07-203-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | `StatementCache` doesn't support range conditions. So we need to through the args to `FinderMethods#find_by` if range value is passed.
* | | | | Merge pull request #29271 from rails/unlock-minitestKasper Timm Hansen2017-08-0215-64/+83
|\ \ \ \ \ | | | | | | | | | | | | Unlock minitest for Rails' test suite