なるようになるブログ

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

rails commit log流し読み(2025/01/08)

2025/01/08分のコミットです。

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

activemodel/CHANGELOG.md

railties/CHANGELOG.md

activesupport/CHANGELOG.md


docs: Update all code snippets to the latest version [ci skip] (#54118)

rails guideのThe Rails Initialization Processの修正です。

guide内にあるRailsのコードのスニペットを最新の内容に更新しています。


Merge pull request #53955 from seanpdoyle/active-model-normalization

Active Record、Active Modelの修正です。

ActiveRecord::NormalizationActiveModel::Attributes::Normalizationに移動し、Active Modelだけでもnormalizes APIを使用出来るよう修正しています。

class User
  include ActiveModel::Attributes
  include ActiveModel::Attributes::Normalization
  attribute :email, :string
  normalizes :email, with: -> email { email.strip.downcase }
end

[ci skip] change "Destroy" to "Delete" on button for consistency

rails guideのGetting Started with Railsの修正です。

Showing Links for Authenticated Users Onlyセクション内のexampleコードで、DeleteDestroyタイポしていたのを修正しています。


Merge pull request #53027 from Uaitt/colorize-prompt-for-non-standard-environments

railties/lib/rails/commands/console/irb_console.rbの修正です。

rails consoleで実行したconsoleで、標準(developmenttestproduction)以外のenvの場合envに色が指定されてなかったのを、色をつけるようにしています。色はマゼンダ。


Merge pull request #54041 from zzak/fix-53754

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

Hash#deep_merge!メソッドのdocがAPI docに表示されなくなっていたのを修正しています。


Merge pull request #54014 from mohsen-alizadeh/issue-54009

rails guideのGetting Started with Railsの修正です。

Rails Routesセクションで、同じroutingを2回定義していたのを修正、及び、CRUD用のroutesについて説明している箇所で、PUT requestとPATCH requestの説明をわけるよう修正しています。


Fix name of the gem being required

activestorage/lib/active_storage/analyzer/image_analyzer/image_magick.rbの修正です。

mini_magick gemのロードでエラーになった場合のエラーチェックで、エラーチェックする際のgem名をタイポしていたのを修正しています。


Merge pull request #53970 from seanpdoyle/deprecate-active-support-configurable

ActiveSupport::Configurableをdeprecatedにしています。Railsのコード内で使用している箇所は1箇所のみで、ActiveSupport::Configurableでないと出来ない機能も特に無い為。代わりにActiveSupport.deprecatorを使用するのが推奨されるようになっています。


CI: Introduce RAILS_MASTER_KEY placeholder

railties/lib/rails/generators/rails/app/templates/github/ci.yml.ttrailties/lib/rails/generators/rails/plugin/templates/github/ci.yml.ttの修正です。

rails newで生成するCI用の設定ファイルで、RAILS_MASTER_KEY envの指定を追加しています。credentialsを使用している場合にCI上でconfig.require_master_keyを参照出来るようにするため。


Merge pull request #53174 from BarnabeD/fix-yarn-dockerfile

railties/lib/rails/generators/app_base.rbrailties/lib/rails/generators/rails/app/templates/Dockerfile.ttの修正です。

rails newで生成するDockerfileでYarnをインストールする際、最新バージョンが必要な場合corepack経由でインストールするよう修正しています。Yarn v2以降はnpm経由だとインストール出来ないため。


Fix boolean columns triggering MySQL deprecation

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

MySQLbooleanを表現するのにtinyint型をlimit: 1を指定して使用していたのを、booleanを使用するよう修正しています。MySQL 8.0.17+でInteger display widthがdeprecatedになっているため。

参考:MySQL :: MySQL 8.0 Release Notes :: Changes in MySQL 8.0.17 (2019-07-22, General Availability)


Merge pull request #54143 from Shopify/fix-action-controller-live-thread-locals-in-test

actionpack/lib/action_controller/metal/live.rbの修正です。

controllerがActionController::Liveをincludeしている場合、test envでmain threadのthread localsが誤ってclearされてしまうバグがあったのを修正しています。


Don't load ActiveStorage::Blob when validating the service

Active Storageの修正です。

Active Storageで使用するserviceのvalidateを行う際に、ActiveStorage::Blobがloadされないよう修正しています。assets:precompileのようにActive Storageが不要な処理でActive Storageがloadされるのを避けるため。


Deprecate String#mb_chars and AS::Multibyte::Chars.

activesupport/lib/active_support/multibyte.rbactivesupport/lib/active_support/multibyte/chars.rbの修正です。

String#mb_chars及びAS::Multibyte::Charsをdeprecatedにしています。Rubyのstringsがencodigを認識してなかった頃に必要だったAPIで、現在のRubyでは使用する必要は無いはずの為。


Avoid triggering AS::Multibyte deprecation when quoting

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

deprecatedになったActiveSupport::Multibyte::Charsをロードしないよう修正しています。


Align example URL with protocol explanation

rails guideのGetting Started with Railsの修正です。

http://example.org -> https://example.orgに修正しています。


Fix small typo on Railties CHANGELOG and comment

railties/CHANGELOG.mdrailties/lib/rails/application/configuration.rbのdocの修正です。

CHANGELOG及びdoc内のタイポを修正しています。