aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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 #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
|/ / /
* | | Ensure `reset_table_name` when table name prefix/suffix is changedRyuta Kamizono2019-04-044-17/+15
| | | | | | | | | | | | | | | Also, `reset_column_information` is unnecessary since `reset_table_name` does that too.
* | | Merge pull request #35842 from Shopify/deduplicate-routing-stringsRafael França2019-04-033-6/+10
|\ \ \ | | | | | | | | Deduplicate strings held by the router
| * | | Deduplicate strings held by the routerJean Boussier2019-04-033-6/+10
| | | |
* | | | Clear query cache when truncate table(s)Ryuta Kamizono2019-04-042-9/+38
| | | |
* | | | Fix fragile testsRyuta Kamizono2019-04-041-2/+4
| | | |
* | | | Respect table name prefix/suffix for `truncate_all`Ryuta Kamizono2019-04-045-5/+67
| | | |
* | | | Merge pull request #35844 from kamipo/fix_fixture_loading_performance_regressionRyuta Kamizono2019-04-047-10/+9
|\ \ \ \ | | | | | | | | | | Use `execute_batch2` rather than `execute_batch` to fix performance regression for fixture loading
| * | | | Use `execute_batch2` rather than `execute_batch` to fix performance ↵Ryuta Kamizono2019-04-047-10/+9
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regression for fixture loading d8d6bd5 makes fixture loading to bulk statements by using `execute_batch` for sqlite3 adapter. But `execute_batch` is slower and it caused the performance regression for fixture loading. In sqlite3 1.4.0, it have new batch method `execute_batch2`. I've confirmed `execute_batch2` is extremely faster than `execute_batch`. So I think it is worth to upgrade sqlite3 to 1.4.0 to use that method. Before: ``` % ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids Using sqlite3 Run options: -n test_eager_loading_too_may_ids --seed 35790 # Running: . Finished in 202.437406s, 0.0049 runs/s, 0.0049 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips ARCONN=sqlite3 bundle exec ruby -w -Itest -n test_eager_loading_too_may_ids 142.57s user 60.83s system 98% cpu 3:27.08 total ``` After: ``` % ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids Using sqlite3 Run options: -n test_eager_loading_too_may_ids --seed 16649 # Running: . Finished in 8.471032s, 0.1180 runs/s, 0.1180 assertions/s. 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips ARCONN=sqlite3 bundle exec ruby -w -Itest -n test_eager_loading_too_may_ids 10.71s user 1.36s system 95% cpu 12.672 total ```
* | | | Merge pull request #35825 from jhawthorn/always_filter_view_pathsEileen M. Uchitelle2019-04-039-44/+42
|\ \ \ \ | | | | | | | | | | Make Resolver#find_all_anywhere equivalent to #find_all
| * | | | Always reject files external to appJohn Hawthorn2019-04-039-44/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when using `render file:`, it was possible to render files not only at an absolute path or relative to the current directory, but relative to ANY view paths. This was probably done for absolutely maximum compatibility when addressing CVE-2016-0752, but I think is unlikely to be used in practice. Tihs commit removes the ability to `render file:` with a path relative to a non-fallback view path. Make FallbackResolver.new private To ensure nobody is making FallbackResolvers other than "/" and "". Make reject_files_external_... no-op for fallbacks Because there are only two values used for path: "" and "/", and File.join("", "") == File.join("/", "") == "/", this method was only testing that the absolute paths started at "/" (which of course all do). This commit doesn't change any behaviour, but it makes it explicit that the FallbackFileSystemResolver works this way. Remove outside_app_allowed argument Deprecate find_all_anywhere This is now equivalent to find_all Remove outside_app argument Deprecate find_file for find Both LookupContext#find_file and PathSet#find_file are now equivalent to their respective #find methods.
* | | | | Merge pull request #35843 from eregon/fix-gem-listen-in-gemfile-masterEileen M. Uchitelle2019-04-031-0/+16
|\ \ \ \ \ | | | | | | | | | | | | Add test that the listen gem is included when RUBY_ENGINE is not 'ruby'
| * | | | | Add test that the listen gem is included when RUBY_ENGINE is not 'ruby'Benoit Daloze2019-04-031-0/+16
| | |/ / / | |/| | | | | | | | | | | | | | | | | | * The fix is already in master since https://github.com/rails/rails/pull/34243 * See https://github.com/rails/rails/pull/35482 for the fix in Rails 5.2
* | | | | [skip ci] Add examples for has_{one,many} :through :source and :source_type ↵Tim Wade2019-04-031-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#35612) * Add example for has_many :through source/source_type * Add example for has_one :through source/source_type
* | | | | Merge pull request #35795 from alimi/cache-database-versionEileen M. Uchitelle2019-04-0318-67/+106
|\ \ \ \ \ | |/ / / / |/| | | | Cache database version in schema cache
| * | | | Cache database version in schema cacheAli Ibrahim2019-04-0318-67/+106
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The database version will get cached in the schema cache file during the schema cache dump. When the database version check happens, the version will be pulled from the schema cache and thus avoid querying the database for the version. * If the schema cache file doesn't exist, we'll query the database for the version and cache it on the schema cache object. * To facilitate this change, all connection adapters now implement #get_database_version and #database_version. #database_version returns the value from the schema cache. * To take advantage of the cached database version, the database version check will now happen after the schema cache is set on the connection in the connection pool.
* | | | [ci skip] Touch up `db:prepare` changelog entryKasper Timm Hansen2019-04-031-1/+3
| | | |
* | | | Merge pull request #35841 from robertomiranda/r/rake-db-prepare-changelogRyuta Kamizono2019-04-031-0/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Add rake db:prepare entry to the CHANGELOG.md [ci skip]
| * | | | Add rake db:prepare entry to the CHANGELOG.mdRoberto Miranda2019-04-031-0/+4
|/ / / /
* | | | Don't normalize `original_app_name`Ryuta Kamizono2019-04-031-2/+2
| | | | | | | | | | | | | | | | | | | | `original_app_name` is used to show error message if giving app name is invalid, it should be shown raw app name.
* | | | `bytes_margin` is only needed when `previous_packet` existsRyuta Kamizono2019-04-031-5/+2
| | | |
* | | | Merge pull request #35840 from ↵Ryuta Kamizono2019-04-031-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | abhaynikam/24405-update-honor-shallow-false-option-doc [ci skip] Doc for shallow: false options should use <tt> for better readability.
| * | | | [ci skip] Doc for shallow: false options should use <tt> for better ↵Abhay Nikam2019-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | readability. PR after #24405
* | | | | Don't assign to `@changed_attributes` in `becomes`Ryuta Kamizono2019-04-031-1/+0
|/ / / / | | | | | | | | | | | | `@changed_attributes` is no longer used since #30985.
* | | | Use official database name [ci skip]Ryuta Kamizono2019-04-037-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * s/Postgres/PostgreSQL/ * s/MYSQL/MySQL/, s/Mysql/MySQL/ * s/Sqlite/SQLite/ Replaced all newly added them after 6089b31.
* | | | Fix the markup for `insert_all` and `upsert_all` docs [ci skip]Ryuta Kamizono2019-04-031-7/+7
| |/ / |/| |
* | | Remove duplicated CHANGELOG entry [ci skip]Ryuta Kamizono2019-04-031-2/+0
| | |
* | | Merge pull request #35833 from soartec-lab/update_guide_cachingRyuta Kamizono2019-04-031-1/+1
|\ \ \ | | | | | | | | Fixed description of the `cache_key_with_version` method [skip ci]
| * | | Fixed description of the `cache_key_with_version` method [ci skip]soartec-lab2019-04-031-1/+1
| | | |
* | | | Auto-correct rubocop offencesRyuta Kamizono2019-04-032-17/+17
| | | |