- 13 8月, 2020 3 次提交
-
-
由 KapilSachdev 提交于
-
由 Jonathan Hefner 提交于
Adds documentation for habtm association always being optional: true [ci skip]
-
由 Sandip Mane 提交于
parent f4471fc7 author Sandip Mane <sandip.mane@bigbinary.com> 1593247595 +0530 committer Sandip Mane <sandip2490@gmail.com> 1597253412 +0530 Adds doc for habtm association for always optional: true Added docs line under definition of habtm with a text containing habtm refers to zero or more associations Added docs line under definition of habtm with a text containing it refers to zero or more associations Updated the sentence to include declaring association for habtm relation
-
- 12 8月, 2020 9 次提交
-
-
由 Jonathan Hefner 提交于
Add baseline defaults section [ci skip]
-
由 Jonathan Hefner 提交于
[ci skip] Add clarity on protect_from_forgery documentation
-
由 Ryuta Kamizono 提交于
Address `ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true`
-
由 Yasuo Honda 提交于
Address `ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true` This pull request fixes #38697 It is caused by `@controller.singleton_class.include @routes.url_helpers` when `@controller` is nil in `ActionController::TestCase`. * Without this commit ```ruby % cd actionview % PARALLEL_WORKERS=1 bin/test test/actionpack/controller/layout_test.rb test/template/url_helper_test.rb --seed 16702 -n "/^(?:LayoutSetInResponseTest#(?:test_layout_symbol_set_in_controller_returning_nil_falls_back_to_default)|UrlHelperTest#(?:test_url_for_with_array_and_only_path_set_to_false))$/" Run options: --seed 16702 -n "/^(?:LayoutSetInResponseTest#(?:test_layout_symbol_set_in_controller_returning_nil_falls_back_to_default)|UrlHelperTest#(?:test_url_for_with_array_and_only_path_set_to_false))$/" .E Error: UrlHelperTest#test_url_for_with_array_and_only_path_set_to_false: ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/http/url.rb:64:in `full_url_for' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/http/url.rb:54:in `url_for' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/route_set.rb:333:in `block in <class:RouteSet>' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/route_set.rb:838:in `url_for' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/route_set.rb:270:in `call' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/route_set.rb:213:in `call' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/route_set.rb:326:in `block in define_url_helper' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb:233:in `polymorphic_method' /Users/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb:116:in `polymorphic_url' /Users/yahonda/src/github.com/rails/rails/actionview/lib/action_view/routing_url_for.rb:104:in `url_for' /Users/yahonda/src/github.com/rails/rails/actionview/test/template/url_helper_test.rb:102:in `test_url_for_with_array_and_only_path_set_to_false' bin/test test/template/url_helper_test.rb:100 Finished in 0.042275s, 47.3093 runs/s, 47.3093 assertions/s. 2 runs, 2 assertions, 0 failures, 1 errors, 0 skips % ```
-
由 Yu Ming 提交于
Update security.md to note that CSRF security token is included in requests automatically when `config.action_controller.default_protect_from_forgery` is set to `true`, which is the default for newly created Rails applications.
-
由 Ryuta Kamizono 提交于
fix: warning: instance variable @controller not initialized Co-authored-by: NSamuel Williams <samuel.williams@oriontransfer.co.nz>
-
由 Jonathan Hefner 提交于
An Active Storage `Blob` must be identified before it can be reliably validated. For direct uploads, a `Blob` is identified when it is attached, rather than when it is created. Before this commit, the sequence of events when attaching a `Blob` was: 1. Find the `Blob`. 2. Assign the `Blob` to an `Attachment`. 3. Save the owner record. 4. Save the `Attachment`. 5. Identify the `Blob`'s true `content_type` from its file. 6. Save the `Blob`. This meant that the owner record's validations might not see the `Blob`'s true `content_type`. After this commit, the sequence of events will be: 1. Find the `Blob`. 2. Identify the `Blob`'s true `content_type` from its file. 3. Assign the `Blob` to an `Attachment`. 4. Save the owner record. 5. Save the `Attachment`. 6. Save the `Blob`. Thus the `Blob`'s true `content_type` will be available when running the owner record's validations.
-
由 Jonathan Hefner 提交于
Document dbconsole command for multiple database [ci skip]
-
由 Abhay Nikam 提交于
-
- 11 8月, 2020 5 次提交
-
-
由 KapilSachdev 提交于
Fixes #39937
-
由 Gannon McGibbon 提交于
Fix `assert_recognizes` on mounted root routes.
-
由 Eileen M. Uchitelle 提交于
Fix missed establish_connection
-
由 Gannon McGibbon 提交于
Allow `assert_recognizes` routing assertions to work on mounted root routes.
-
由 eileencodes 提交于
In `connected_to` one of the deprecated arguments wasn't well tested so the incorrect methods signature wasn't caught by the tests. This change updates the caller when `connected_to` uses the database key. I've also cleaned up a few arguments that weren't necessary. Since the handler methods set defaults for the `shard` key, we don't need to pass that in `establish_connection` when not using the sharding API.
-
- 10 8月, 2020 4 次提交
-
-
由 Eileen M. Uchitelle 提交于
Add helper method for resetting connection handlers in tests
-
由 eileencodes 提交于
This change makes a helper method for resetting connection handlers in the Active Record tests. The change here is relatively small and may seem unnecessary. The reason we're pushing this change is for upcoming refactoring to connection management. This change will mean that we can update one location instead of 9+ files to reset connections. It will reduce the diff of our refactoring and make reusing this code easier in the future. The method name chosen is purposefully `clean_up_connection_handler` over `clean_up_connection_handlers` because in the future there will only be one handler. Co-authored-by: NJohn Crepezzi <john.crepezzi@gmail.com>
-
由 Eileen M. Uchitelle 提交于
Rename `pool_key` to `shard` and use kwargs for connection methods
-
由 Ryuta Kamizono 提交于
Fix incorrect result when eager loading with duplicated through association with join scope
-
- 08 8月, 2020 5 次提交
-
-
由 Corey Smith 提交于
-
由 Eileen M. Uchitelle 提交于
Remove unnecessary with_temporary_connection_pool calls
-
由 eileencodes 提交于
This change ensures that the connection methods are using kwargs instead of positional arguments. This change may look unnecessary but we're working on refactoring connection management to make it more robust and flexible so the method signatures of the methods changed here will continue to evolve and change. This commit does not change any released public APIs. The `shard` and `owner_name` arguments were added in 6.1 which is not released yet. Using kwargs will allow these methods to be more flexible and not get super ugly as we change their underlying behavior. The kwargs let us support multiple non-positional arguments with default. Co-authored-by: NJohn Crepezzi <john.crepezzi@gmail.com>
-
由 eileencodes 提交于
This change renames the following: * `current_pool_key` -> `current_shard` * `default_pool_key` -> `default_shard` * `pool_key` -> `shard` Originally we had intended to name the `shard` as `pool_key` because when we implemented the internal private API we weren't sure how it was going to be used for sharding and wanted to implement behavior without promising a public API. Now that we have a public API for sharding it's better to use the same name everywhere rather than have one name for private APIs and one name for public APIs. This should make contributions and tracking down bugs easier in the future. This PR doesn't require any deprecations because the sharding API is unreleased and so is all the internal code that was using `pool_key`. Co-authored-by: NJohn Crepezzi <john.crepezzi@gmail.com>
-
由 eileencodes 提交于
While debugging a different problem I'm working on I realized that this method `with_temporary_connection_pool` isn't necessary in most of the cases we're using it for. Anywhere we establish new connections inside the block won't throw away those new connections. I also removed this from places that can use the existing connection and don't need a new temporary pool. I'm not sure if this file was using it in many places because of copy / paste or real issues that are no longer present.
-
- 07 8月, 2020 8 次提交
-
-
由 Ryuta Kamizono 提交于
Fix deserializing enum mapping nil
-
由 Ryuta Kamizono 提交于
I had found the issue while working on fixing #33525. That is if duplicated association has a scope which has `where` with explicit table name condition (e.g. `where("categories.name": "General")`), that condition in all duplicated associations will filter the first one only, other all duplicated associations are not filtered, since duplicated joins will be aliased except the first one (e.g. `INNER JOIN "categories" "categories_categorizations"`). ```ruby class Author < ActiveRecord::Base has_many :general_categorizations, -> { joins(:category).where("categories.name": "General") }, class_name: "Categorization" has_many :general_posts, through: :general_categorizations, source: :post end authors = Author.eager_load(:general_categorizations, :general_posts).to_a ``` Generated eager loading query: ```sql SELECT "authors"."id" AS t0_r0, ... FROM "authors" -- `has_many :general_categorizations, -> { joins(:category).where("categories.name": "General") }` LEFT OUTER JOIN "categorizations" ON "categorizations"."author_id" = "authors"."id" INNER JOIN "categories" ON "categories"."id" = "categorizations"."category_id" AND "categories"."name" = ? -- `has_many :general_posts, through: :general_categorizations, source: :post` ---- duplicated `through: :general_categorizations` part LEFT OUTER JOIN "categorizations" "general_categorizations_authors_join" ON "general_categorizations_authors_join"."author_id" = "authors"."id" INNER JOIN "categories" "categories_categorizations" ON "categories_categorizations"."id" = "general_categorizations_authors_join"."category_id" AND "categories"."name" = ? -- <-- filtering `"categories"."name" = ?` won't work ---- `source: :post` part LEFT OUTER JOIN "posts" ON "posts"."id" = "general_categorizations_authors_join"."post_id" ``` Originally eager loading with join scope didn't work before Rails 5.2 (#29413), and duplicated through association with join scope raised a duplicated alias error before alias tracking is improved in 590b045e. But now it will potentially be got incorrect result instead of an error, it is worse than an error. To fix the issue, it makes eager loading to deduplicate / re-use duplicated through association if possible, like as `preload`. ```sql SELECT "authors"."id" AS t0_r0, ... FROM "authors" -- `has_many :general_categorizations, -> { joins(:category).where("categories.name": "General") }` LEFT OUTER JOIN "categorizations" ON "categorizations"."author_id" = "authors"."id" INNER JOIN "categories" ON "categories"."id" = "categorizations"."category_id" AND "categories"."name" = ? -- `has_many :general_posts, through: :general_categorizations, source: :post` ---- `through: :general_categorizations` part is deduplicated / re-used LEFT OUTER JOIN "posts" ON "posts"."id" = "categorizations"."post_id" ``` Fixes #32819.
-
由 Ryuta Kamizono 提交于
Follow up to #38086. User assigned nil is type casted by #38086, but loaded nil from database does not yet, this fixes that.
-
由 Ryuta Kamizono 提交于
Make `Enumerable.pluck` faster for single key
-
由 Ryuta Kamizono 提交于
Directly `klass.new` is clear enough than factory methods.
-
由 Alexey Savin 提交于
-
由 Jonathan Hefner 提交于
Update GitHub gist api link and fix documentation in api_app guide [ci skip]
-
由 assain 提交于
The GitHub gist API page is out of date. This commit replaces it with the new link. Also, removed unnecessary commas, added missing fullstop and fixed a ruby snippet which wasn't rendered correctly before.
-
- 05 8月, 2020 3 次提交
-
-
由 Eileen M. Uchitelle 提交于
Get rid of the unused RuntimeRegistry.connection_handler
-
由 Jean Boussier 提交于
It's no longer used since https://github.com/rails/rails/commit/5ce3e022ef136324d288fb493e0938e76a74981a
-
由 Eugene Kenny 提交于
--skip-action-mailer option doesn't work for "rails plugin new"
-
- 04 8月, 2020 3 次提交
-
-
由 Eileen M. Uchitelle 提交于
Move advisory locks to own connection handler.
-
由 Michael Hagar 提交于
-
由 Lawrence Chou 提交于
Closes #37411.
-