aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Association loading isn't to be affected by null relation scopingRyuta Kamizono2019-04-063-3/+31
| | | | | | | | | | | | | | | | | | Follow up of #35868. Closes #19349.
* | | Merge pull request #35868 from ↵Ryuta Kamizono2019-04-064-8/+48
|\ \ \ | | | | | | | | | | | | | | | | kamipo/association_isnt_to_be_affected_by_scoping_consistently Association loading isn't to be affected by scoping consistently
| * | | Association loading isn't to be affected by scoping consistentlyRyuta Kamizono2019-04-054-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up of 5c71000, #29834, and #30271. Currently, preloading and eager loading are not to be affected by scoping, with the exception of `unscoped`. But non eager loaded association access is still affected by scoping. Although this is a breaking change, the association loading will work consistently whether preloaded / eager loaded or not. Before: ```ruby Post.where("1=0").scoping do Comment.find(1).post # => nil Comment.preload(:post).find(1).post # => #<Post id: 1, ...> Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...> end ``` After: ```ruby Post.where("1=0").scoping do Comment.find(1).post # => #<Post id: 1, ...> Comment.preload(:post).find(1).post # => #<Post id: 1, ...> Comment.eager_load(:post).find(1).post # => #<Post id: 1, ...> end ``` Fixes #34638. Fixes #35398.
* | | | The default value without loading railtie is false [ci skip] (#35881)प्रथमेश Sonpatki2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/rails/rails/pull/35873#issuecomment-480333333 for reference [Prathamesh Sonpatki, bogdanvlviv]
* | | | Merge pull request #35873 from prathamesh-sonpatki/enqueuing-fixesEileen M. Uchitelle2019-04-052-2/+2
|\ \ \ \ | | | | | | | | | | Fix the deprecation warning about `config.active_job.return_false_on_aborted_enqueue`
| * | | | Fix the deprecation warning about ↵Prathamesh Sonpatki2019-04-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `config.active_job.return_false_on_aborted_enqueue` - It will return false in Rails 6.1 not 6.0. Also fixed the default value which is true for new applications.
* | | | | Merge pull request #35876 from abhaynikam/fix-typo-for-touch-later-test-caseRyuta Kamizono2019-04-051-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix typo for touch later test description. laster -> later
| * | | | | Fix typo for touch later test description. laster -> laterAbhay Nikam2019-04-051-1/+1
|/ / / / /
* | | | | Add Active Job release notes [ci skip] (#35872)प्रथमेश Sonpatki2019-04-052-2/+48
| | | | |
* | | | | Merge pull request #35871 from kamipo/klass_level_touch_allRyuta Kamizono2019-04-053-2/+34
|\ \ \ \ \ | | | | | | | | | | | | Add missing `touch_all` delegation to relation
| * | | | | Add missing `touch_all` delegation to relationRyuta Kamizono2019-04-053-2/+34
| | |/ / / | |/| | | | | | | | | | | | | Follow up of #31513.
* | | | | Merge pull request #35870 from abhaynikam/mark-touch-later-as-private-docRyuta Kamizono2019-04-051-1/+1
|\ \ \ \ \ | |_|_|/ / |/| | | | [ci skip] Mark ActiveRecord::TouchLater as private doc
| * | | | [ci skip] Mark ActiveRecord::TouchLater as private docAbhay Nikam2019-04-051-1/+1
|/ / / /
* | | | Merge pull request #35867 from y-yagi/do_not_exclude_paths_in_global_levelYuji Yaginuma2019-04-051-6/+0
|\ \ \ \ | |/ / / |/| | | Do not exclude paths in the global level of Code Climate
| * | | Do not exclude paths in the global level of Code Climateyuuji.yaginuma2019-04-051-6/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | We use only RuboCop in Code Climate and exclude paths are specified in RuboCop's setting. The global level excludes paths should not be specified to match the behavior of local and CodeClimate.
* | | `preloaded_records` no longer includes `nil` since #35496Ryuta Kamizono2019-04-051-1/+0
| | |
* | | Bump addressable to 2.6.0 to fix warning: assigned but unused variable - ↵Ryuta Kamizono2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | startercc https://github.com/sporkmonger/addressable/pull/270
* | | `ast` is no longer to be `nil` since #33118Ryuta Kamizono2019-04-051-1/+0
| | |
* | | Remove duplicated `test_find_last`Ryuta Kamizono2019-04-051-5/+0
| | | | | | | | | | | | This is completely same with `test_last`.
* | | Merge pull request #35864 from kamipo/improve_left_joinsRyuta Kamizono2019-04-056-32/+45
|\ \ \ | | | | | | | | Stash `left_joins` into `joins` to deduplicate redundant LEFT JOIN
| * | | Stash `left_joins` into `joins` to deduplicate redundant LEFT JOINRyuta Kamizono2019-04-056-32/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally the `JoinDependency` has the deduplication for eager loading (LEFT JOIN). This re-uses that deduplication for `left_joins`. And also, This makes left join order into part of joins, i.e.: Before: ``` association joins -> stash joins (eager loading, etc) -> string joins -> left joins ``` After: ``` association joins -> stash joins (eager loading, left joins, etc) -> string joins ``` Now string joins are able to refer left joins. Fixes #34325. Fixes #34332. Fixes #34536.
* | | | Merge pull request #35863 from urkle/fix-typo-in-guidesVipul A M2019-04-051-1/+1
|\ \ \ \ | | | | | | | | | | fix typo in the guides (use Rails instead of rails) [ci skip]
| * | | | fix typo in the guides (use Rails instead of rails)Edward Rudd2019-04-041-1/+1
|/ / / /
* | | | Merge pull request #35861 from sharang-d/after_save_commit-callback-docVipul A M2019-04-051-2/+25
|\ \ \ \ | | | | | | | | | | Add documentation for 'after_save_commit' [ci skip]
| * | | | Add documentation for 'after_save_commit' [ci skip]Sharang Dashputre2019-04-051-2/+25
|/ / / /
* | | | Merge pull request #35691 from ↵Rafael França2019-04-042-6/+78
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | sushantmittal/add_deattach_from_in_active_support_subscriber Adds 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace.
| * | | | Added 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber ↵sushant2019-04-042-6/+78
| | | | | | | | | | | | | | | | | | | | from a namespace.
* | | | | Merge pull request #35858 from ↵Rafael França2019-04-041-3/+3
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | localhostdotdev/add-extensions-to-arity-error-message Fix arity warning for template handlers
| * | | | Fix arity warning for template handlerslocalhostdotdev2019-04-041-3/+3
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mainly to help with knowning which template is reponsible for the warning. handler.class # => Class handler.to_s # => Coffee::Rails::TemplateHandler Before: Change: >> Class#call(template) To: >> Class#call(template, source) After: Change: >> Coffee::Rails::TemplateHandler.call(template) To: >> Coffee::Rails::TemplateHandler.call(template, source)
* / | | Refactor `has_secure_password` to extract dedicated attribute moduleRyuta Kamizono2019-04-053-36/+59
|/ / / | | | | | | | | | | | | | | | Follow up of #26764 and #35700. And add test case for #35700.
* | | Merge pull request #35700 from Futurelearn/seb-secure-password-fixRyuta Kamizono2019-04-051-26/+30
|\ \ \ | | | | | | | | Reintroduce support for overriding `has_secure_password` attributes
| * | | Reintroduce support for overriding `has_secure_password` attributesSeb Jacobs2019-03-221-26/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Rails 5.2.x calling `has_secure_password` would define attribute readers and writers on the superclass of the model, which meant that you could override these attributes in a model and call the superclass for example: ``` class Dog < ApplicationRecord has_secure_password def password=(new_password) @password_set = new_password.present? super end end ``` However this behaviour was broken in Rails 6 when the ability to customise the name of the attribute was introduced [1] since they are no longer being defined on the superclass you will now see the following error: ``` NoMethodError: super: no superclass method `password=' for #<Dog:0x00007ffbbc7ce290> Did you mean? password ``` In order to resolve this issue and retain support for setting a custom attribute name we can define these attribute readers/writers in a module and then ensure that the module is included in the inheritance chain. [1] https://www.github.com/rails/rails/commit/86a48b4da3 https://www.github.com/rails/rails/commit/9b63bf1dfd
* | | | Fix rubocop offence for `Style/FrozenStringLiteralComment`Ryuta Kamizono2019-04-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` % be rubocop -a Inspecting 2777 files ..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Offenses: tools/test_common.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true. if ENV["BUILDKITE"] ^ 2777 files inspected, 1 offense detected, 1 offense corrected ```
* | | | Merge pull request #35856 from prathamesh-sonpatki/fix-dep-warningKasper Timm Hansen2019-04-041-2/+2
|\ \ \ \ | | | | | | | | | | Fix deprecation warning about variants and formats
| * | | | Fix deprecation warning about variants and formatsPrathamesh Sonpatki2019-04-041-2/+2
|/ / / / | | | | | | | | | | | | | | | | | | | | - After https://github.com/rails/rails/pull/35408 and https://github.com/rails/rails/pull/35406, the `formats` and `variants` methods are deprecated in favor of `format` and `variant`.
* | | | Merge pull request #35698 from mtsmfm/output-test-reportMatthew Draper2019-04-0416-0/+48
|\ \ \ \ | | | | | | | | | | Output junit format test report
| * | | | Output junit format test reportFumiaki MATSUSHIMA2019-04-0416-0/+48
| | | | |
* | | | | Merge pull request #35850 from ↵Ryuta Kamizono2019-04-043-4/+17
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | kamipo/fix_count_all_with_eager_loading_and_select_and_order Fix `count(:all)` with eager loading and explicit select and order
| * | | | Fix `count(:all)` with eager loading and explicit select and orderRyuta Kamizono2019-04-043-4/+17
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up ebc09ed9ad9a04338138739226a1a92c7a2707ee. We've still experienced a regression for `size` (`count(:all)`) with eager loading and explicit select and order when upgrading Rails to 5.1. In that case, the eager loading enforces `distinct` to subselect but still keep the custom select, it would cause the ORDER BY with DISTINCT issue. ``` % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/relations_test.rb -n test_size_with_eager_loading_and_custom_select_and_order Using postgresql Run options: -n test_size_with_eager_loading_and_custom_select_and_order --seed 8356 # Running: E Error: RelationTest#test_size_with_eager_loading_and_custom_select_and_order: ActiveRecord::StatementInvalid: PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ..." ON "comments"."post_id" = "posts"."id" ORDER BY comments.i... ^ ``` As another problem on `distinct` is enforced, the result of `count` becomes fewer than expected if `select` is given explicitly. e.g. ```ruby Post.select(:type).count # => 11 Post.select(:type).distinct.count # => 3 ``` As long as `distinct` is enforced, we need to care to keep the result of `count`. This fixes both the `count` with eager loading problems.
* | | | Merge pull request #35848 from kamipo/refactor_collection_cache_keyRyuta Kamizono2019-04-045-54/+49
|\ \ \ \ | | | | | | | | | | Refactor `Relation#cache_key` is moved from `CollectionCacheKey#collection_cache_key`
| * | | | Refactor `Relation#cache_key` is moved from ↵Ryuta Kamizono2019-04-045-54/+49
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `CollectionCacheKey#collection_cache_key` The implementation of `Relation#cache_key` depends on some internal relation methods (e.g. `apply_join_dependency`, `build_subquery`), but somehow that implementation exists on the model class (`collection_cache_key`), it sometimes bothers to me. This refactors that implementation moves to `Relation#cache_key`, then we can avoid `send` to call internal methods.
* | | | Merge pull request #35847 from kamipo/optimizer_hints_with_count_subqueryRyuta Kamizono2019-04-045-5/+30
|\ \ \ \ | | | | | | | | | | Optimizer hints should be applied on Top level query as much as possible
| * | | | Optimizer hints should be applied on Top level query as much as possibleRyuta Kamizono2019-04-045-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | I've experienced this issue in our app, some hints only works on Top level query (e.g. `MAX_EXECUTION_TIME`).
* | | | | Merge pull request #35145 from st0012/fix-35114Rafael França2019-04-033-13/+43
|\ \ \ \ \ | |/ / / / |/| | | | Fix partial caching ignore repeated items issue
| * | | | Fix partial caching ignore repeated items issuest00122019-04-043-13/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is because we only use hash to maintain the result. So when the key are the same, the result would be skipped. The solution is to maintain an array for tracking every item's position to restructure the result.
* | | | | Remove redundant begin blockRyuta Kamizono2019-04-041-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | We have `Style/RedundantBegin` cop (#34764) but it could not correct in this case.
* | | | | Don't drop internal metadata tablesRyuta Kamizono2019-04-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests expects that internal metadata tables exists, and we should not use `create_table` in transactional tests, since DDL in MySQL causes implicit commit. https://travis-ci.org/rails/rails/jobs/515438937#L3829
* | | | | Merge pull request #30666 from urkle/fix-actionview-fixtureresolverRafael França2019-04-035-2/+60
|\ \ \ \ \ | | | | | | | | | | | | Fix checking for template variants when using the ActionView::FixtureResolver
| * | | | | add documentation about variantsEdward Rudd2019-04-032-0/+44
| | | | | |
| * | | | | Fix checking for template variants when using the ActionView::FixtureResolverEdward Rudd2019-04-033-2/+16
|/ / / / /