なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2024/02/21)

2024/02/21分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md

actionpack/CHANGELOG.md


Merge pull request #51130 from Yegorov/fix-typo-in-devcontainer

railties/lib/rails/generators/devcontainer.rbの修正です。

devcontainerで作成するnetwork名をタイポしていたのを修正しています。


Fix typos

actionmailbox/app/controllers/action_mailbox/ingresses/relay/inbound_emails_controller.rbのdocの修正です。

ActionMailbox::Ingresses::Relay::InboundEmailsControllerのdocのフォーマットを修正しています。


Merge pull request #51141 from peterberkenbosch/update-test-case-generator-to-codestyle

railties/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.ttの修正です。

generatorで生成されるapplication_system_test_case.rbにRubocopでエラーになる箇所があったのを修正しています。


Merge pull request #51118 from fatkodima/missing-connection_pool-in-errors-assignments

Active Recordの修正です。

Store connection_pool in database-related exceptionsでDB関連のexceptionでconnection_poolの値を保持するよう修正したのですが、connection_poolを指定し忘れているexceptionがあったので、そちらにもexceptionを渡すよう修正しています。


Improve title tag for new apps (#51134)

railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.ttの修正です。

titleのタグのデフォルト値にアプリ名を使用するよう修正しています。


Remove deprecated Rails.application.config.active_record.suppress_multiple_database_warning

activerecord/lib/active_record.rbの修正です。

deprecatdになっていたRails.application.config.active_record.suppress_multiple_database_warningを削除しています。


[R] Remove deprecated support to call alias_attribute with non-existent attribute names

activerecord/lib/active_record/attribute_methods.rbの修正です。

deprecatedになっていた、存在しないattribute namesに対するalias_attributeのサポートを削除しています。


Remove deprecated name argument from ActiveRecord::Base.remove_connection

activerecord/lib/active_record/connection_handling.rbの修正です。

deprecatedになっていたActiveRecord::Base.remove_connectionname引数を削除しています。


Remove deprecated methods in ActiveRecord::Base

activerecord/lib/active_record/connection_handling.rbの修正です。

deprecatedになっていた、ActiveRecord::Base.clear_active_connections!ActiveRecord::Base.clear_reloadable_connections!ActiveRecord::Base.clear_all_connections!及びActiveRecord::Base.flush_idle_connections!メソッドを削除しています。


Remove deprecated ActiveRecord::ActiveJobRequiredError

activerecord/lib/active_record/errors.rbの修正です。

deprecatedになっていたActiveRecord::ActiveJobRequiredErrorを削除しています。


Remove deprecated support to define explain in the connection adapter with 2 arguments

activerecord/lib/active_record/explain.rbの修正です。

ddeprecatedになっていた、connection adapterに引数を2つ受け取れるexplainメソッドを定義した場合のサポートを削除しています。


Remove deprecated methods on ActiveRecord::LogSubscriber

activerecord/lib/active_record/log_subscriber.rbの修正です。

deprecatedになっていた、ActiveRecord::LogSubscriber.runtimeActiveRecord::LogSubscriber.runtime=及びActiveRecord::LogSubscriber.reset_runtimeメソッドを削除しています。


Remove deprecated ActiveRecord::Migration.check_pending method

activerecord/lib/active_record/migration.rbの修正です。

deprecatedになっていたActiveRecord::Migration.check_pendingメソッドを削除しています。


Remove deprecated support to passing SchemaMigration and InternalMetadata classes as arguments to ActiveRecord::MigrationContext.

activerecord/lib/active_record/migration.rbの修正です。

deprecatedになっていたActiveRecord::MigrationContextSchemaMigration及びInternalMetadataを渡した場合の挙動を削除しています。


Remove deprecated behavior to support referring to a singular association by its plural name

activerecord/lib/active_record.rbactiverecord/lib/active_record/table_metadata.rbの修正です。

deprecatedになっていた、singular associationをplural nameで指定した場合の挙動を削除しています。合わせて、この挙動を制御するためのconfig(Rails.application.config.active_record.allow_deprecated_singular_associations_name)をdeprecatedにしています。


Remove deprecated TestFixtures.fixture_path

activerecord/lib/active_record/test_fixtures.rbの修正です。

deprecatedになっていたTestFixtures.fixture_pathを削除しています。


Remove deprecated support to ActiveRecord::Base#read_attribute(:id) to return the custom primary key value

activerecord/lib/active_record/attribute_methods/read.rbの修正です。

deprecatedになっていたActiveRecord::Base#read_attribute(:id)がcustom primary keyの値を返す挙動を削除しています。


Remove deprecated support to passing coder and class as second argument to serialize

activerecord/lib/active_record/attribute_methods/serialization.rbの修正です。

deprecatedになっていたserializeメソッドの第二引数にcoderとclassを指定した場合のサポートを削除しています。


Remove deprecated #all_foreign_keys_valid? from database adapters

activerecord/lib/active_record/connection_adapters/abstract_adapter.rbの修正です。

deprecatedになっていたdatabase adapterの#all_foreign_keys_valid?メソッドを削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::SchemaCache.load_from

activerecord/lib/active_record/connection_adapters/schema_cache.rbの修正です。

deprecatedになっていたActiveRecord::ConnectionAdapters::SchemaCache.load_fromメソッドを削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::SchemaCache#data_sources

activerecord/lib/active_record/connection_adapters/schema_cache.rbの修正です。

deprecatedになっていたActiveRecord::ConnectionAdapters::SchemaCache#data_sourcesを削除しています。


Remove deprecated #all_connection_pools

activerecord/lib/active_record/connection_adapters/schema_cache.rbの修正です。

deprecatedになっていた#all_connection_poolsを削除しています。


Remove deprecated support to apply some methods in the Connection Handle to the connections pools for the current role when the role arguments isn't provided

activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rbの修正です。

role引数が指定されなかった場合に、#connection_pool_list, #active_connections?, #clear_active_connections!,#clear_reloadable_connections!, #clear_all_connections! 及び #flush_idle_connections!メソッドでcurrent roleのconnection poolをデフォルトで使用する挙動を削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass

activerecord/lib/active_record/connection_adapters/abstract/quoting.rbの修正です。

deprecatedになっていたActiveRecord::ConnectionAdapters::ConnectionPool#connection_klassを削除しています。


Remove deprecated #quote_bound_value

activerecord/lib/active_record/connection_adapters/abstract/quoting.rbの修正です。

deprecatedになっていた#quote_bound_valueを削除しています。


Remove deprecated support to quote ActiveSupport::Duration

activerecord/lib/active_record/connection_adapters/abstract/quoting.rbの修正です。

deprecatedになっていた、SQL string template でActiveSupport::Durationインスタンスをinterpolated bind parameterとして渡した場合の挙動を削除しています。


Remove deprecated support to pass deferrable: true to add_foreign_key

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbactiverecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rbの修正です。

deprecatedになっていたadd_foreign_keydeferrable: trueを指定した場合の挙動を削除しています。


Remove deprecated support to pass rewhere to ActiveRecord::Relation#merge

Active Recordの修正です。

deprecatedになっていたActiveRecord::Relation#mergerewhere引数を指定した場合の挙動を削除しています。


Remove deprecated behavior that would rollback a transaction block when exited using return, break or throw.

activerecord/lib/active_record.rbactiverecord/lib/active_record/connection_adapters/abstract/transaction.rbの修正です。

deprecatedになっていた、transaction block内でreturn, break 又は throwを実行した場合にrollackをする、という挙動を削除しています。合わせて、この挙動を制御するためのconfig(Rails.application.config.active_record.commit_transaction_on_non_local_return)を削除しています。


Merge pull request #51112 from dorianmariecom/dorian/to_s-for-generated-attribute

railties/lib/rails/generators/generated_attribute.rbの修正です。

generated attributeをstringに変換するためのRails::Generators::GeneratedAttribute#to_sメソッドを追加しています。独自のgeneratorからmodel generatorの引数を呼び出す際に、フォーマットしたattributeを簡易に取得できるようにする為。


Merge pull request #51125 from c960657/log-outputs-to-filename

activesupport/lib/active_support/logger.rbの修正です。

Logger.logger_outputs_to?にファイル名を指定できるよう修正しています。

Logger.logger_outputs_to?('/var/log/rails.log')

Merge pull request #51047 from johnpitchko/add-query-docs-to-delegated-type

activerecord/lib/active_record/delegated_type.rbのdocの修正です。

delegated typeのdocにrecordを跨いでのqueryを実行する場合の説明を追加しています。


Merge pull request #51131 from tonytonyjan/filter-redirect-params

actionpack/lib/action_dispatch/http/filter_redirect.rbの修正です。

locationのredirectを行う際に、URLにconfig.filter_parametersに指定したパラメータ名が含まれている場合、自動でそのパラメータをfilterするよう修正しています。

http://secret.foo.bar?username=roque&password=[FILTERED]

Merge pull request #51132 from tonytonyjan/docs/fix-fetch-example

activesupport/lib/active_support/cache.rbのdocの修正です。

ActiveSupport::Cache::Store#fetchのdoc内のrace conditionが発生する場合の挙動についての説明について、不要なスレッドの削除、コメントの削除等を行っています。


Increase assert_output timeout for FullStackConsoleTest and ApplicationTests::ServerTest

railties/test/application/console_test.rbrailties/test/application/server_test.rbの修正です。

console、及び、serverのテストで結果が取得できるまでのtimeoutの時間を伸ばしています。


Don't force controller or integration tests to load

railties/lib/rails/test_help.rbの修正です。

action_controller/test_case及びaction_dispatch/testing/integrationをrequireしないよう修正しています。modelのテストなどを実行する際に、不要なcontroller test及びintegration testのrequireを避ける為。


clear_query_caches_for_current_thread: avoid pinning all connections

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rbactiverecord/lib/active_record/connection_handling.rbの修正です。

poolのquery cacheをclearする際に、connectionのchekckout処理を行わないよう修正しています。Refactor QueryCache to be owned by the poolの対応でquery cacheはpoolで保持されるようになっており、clearするのにconnectionを経由する必要が無くなっている為。


Don't forcefully clear temporarily disabled query caches

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rbactiverecord/lib/active_record/query_cache.rbの修正です。

query cacheが一時的にdisabledになった場合に強制的に保持していたcacheをclearしていたのを、clearしないよう修正しています。read only queryなどを実行している場合clearする必要が無いはず、かつ、query cacheを再度有効化した場合にもclear処理を行っている為。


Fix code formatting in layouts and rendering guide

rails guideのLayouts and Rendering in Railsの修正です。

The :variants Optionセクションにあるexampleコードのフォーマットを修正しています。


Relation#where build BoundSqlLiteral rather than eagerly interpolate

Active Recordの修正です。

Relation#whereでquery/relationを構築する際に、SQL fragmentのquoteやinterpolation valueの設定を行っていたのを、それらは行わず代わりにBoundSqlLiteralを構築するよう修正しています。左記の処理はconnection settingに依存する為処理を行うのにconnectionが必要なのですが、PoC: Add an option to disable connection checkout cachingの為にconnectionを使う処理を減らす対応を行っており、その一環との事です。


Remove unused intermediate variable

activerecord/lib/active_record/connection_adapters/abstract/transaction.rbの修正です。

使用していない変数を削除しています。