なるようになるブログ

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

rails commit log流し読み(2023/09/26)

2023/09/26分のコミットです。

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

actionmailer/CHANGELOG.md

activesupport/CHANGELOG.md


[skip ci] Missing language highligting added for bash code block

rails guideのUpgrading Ruby on Railsの修正です。

exampleコードにcode highligtの指定が無い箇所があったのを修正しています。


Merge pull request #49336 from fatkodima/fix-mysql-expression-index-dumping

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

MySQL adapterでexpression indexをschemaファイルにdumpする際に、quoteに対するescape処理が不足していたのを修正しています。


Actually upload the files when passed as File or Pathname

activestorage/lib/active_storage/attached/changes/create_one.rbの修正です。

has_one_attachedを指定しているattributeにFile及びPathnameのオブジェクトを指定してのattachを出来るよう対応したAllow attaching File or Pathname to has_one_attachedで、DBへのデータへの保存は出来ていたがstorageへのファイルのアップロードが出来てなかったのを修正しています。


Merge pull request #45411 from jonathanhefner/add-deep_mergeable

activesupport/lib/active_support/core_ext/hash/deep_merge.rbactivesupport/lib/active_support/deep_mergeable.rbの修正です。

Hash#deep_mergeの実装を専用のmodule(ActiveSupport::DeepMergeable)に移動しています。ほかのクラス(ActionController::Parameters)でも同じ実装を使用出来るようにするため。


Merge pull request #49322 from hachi8833/add_tests_for_exclusion_validation2

activemodel/test/cases/validations/exclusion_validation_test.rbの修正です。

validates_exclusion_ofにbeginless/endless rangeを指定した場合のテストを追加しています。


Introduce ActionMailer::FormBuilder

Action Mailerの修正です。

mailerのviewのformで使用するdefault form builderをdefault_form_builderメソッドで指定出来るよう修正しています。controllerでは指定出来るようなっており、挙動をあわせるため。


Add a public API for broadcasting logs:

Active Supportの修正です。

異なる複数のIOにまとめてログを出力出来るようにするためのbroadcasting logsの仕組みをpublic APIとして公開しています。

stdout_logger = Logger.new(STDOUT)
file_logger = Logger.new("development.log")
broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger)

broadcast.info("Hello!") # ログはSTDOUTと"development.log"ファイル両方に出力される

Fix ruby warning

activesupport/test/deep_mergeable_test.rbの修正です。

[]メソッド再定義によるRubyのwarningが出ていたのを修正しています。


Define the method in the right place

activesupport/test/deep_mergeable_test.rbの修正です。

先程のRubyのwarning対応で行ったメソッドの定義方法が誤っていたのを修正しています。


Remove erroneous committed file

activerecord/test/storage/test.sqlite3の修正です。

SQLiteのDBファイルがコミットされてしまっていたのを削除しています。


Don't leak database connection to other tests

activerecord/test/cases/adapters/postgresql/connection_test.rbの修正です。

特定のテストでのみ使用する事を想定しているconnectionを、テストの後処理で削除するよう修正しています。


Update description for filter_parameter_logging (#49347)

railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.ttの修正です。

Rails.application.config.filter_parameterに関する説明の言い回しを修正しています。


Rename back unique keys to unique constraints

Active Recordの修正です。

PostgreSQLのunique constraintsを追加/削除するメソッドの名前がadd_unique_key/remove_unique_keyになっていたのを、add_unique_constraint/remove_unique_constraintに変更しています。ドキュメント等の説明でunique constraintsを追加/削除する為の処理である旨説明されており、その為のメソッドがadd_unique_key/remove_unique_keyとなっているのは混乱の元だろう、という事で変更されています。


Fix typo "an unique" -> "a unique" [ci skip]

activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rbのdocの修正です。

unique_constraintメソッドのdocのグラマーの修正を行っています。


Revert "Document clean chain behavior for ActiveRecord scope"

rails guideのscopeをchainした場合の挙動について説明した、Document clean chain behavior for ActiveRecord scopeをRevertしています。

説明として誤っていたり不明呂な箇所があり、一旦Revertして再度PRを作成して改善するのが良いのでは、という指摘が入った為Revertされています。


Add 7.1 release notes for SQLite3 adapter improvements

rails guideのRuby on Rails 7.1 Release Notesの修正です。

Add SQLite3 support for supports_insert_returning?Performance tune the SQLite3 adapter connection configurationなどで行われたSQLite3 adapter関連の改善についてNotable changesに説明を追加しています。