なるようになるブログ

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

rails commit log流し読み(2025/04/02)

2025/04/02分のコミットです。

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

activesupport/CHANGELOG.md


[ci skip] docs(activestorage): Update default variant processor

activestorage/app/models/active_storage/variant.rbのdocの修正です。

doc内に、Active Storageのvariant processorのデフォルトがMiniMagickである旨説明が記載されていたのを、デフォルトはruby-vipsである旨説明を修正しています。


misc: fix spelling in Markdown and Ruby files

テスト名や変数名のスペルミスを修正しています。


Add Cache#read_counter and Cache#write_counter

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

Cache#read_counter及びCache#write_counterメソッドを追加しています。Cache#incrementCache#decrementで値の増減をしているcacheの値を読み込む/書き込む為に使うことを想定している、との事です。

``ruby Rails.cache.write_counter("foo", 1) Rails.cache.read_counter("foo") # => 1 Rails.cache.increment("foo") Rails.cache.read_counter("foo") # => 2

***

[Use status code 303 for redirect in destroy action](https://github.com/rails/rails/commit/53dd70cfe063faf730d7190af38b602187a55103)

`railties/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt`の修正です。

`authentication` generatorが生成する`sessions_controller.rb`内の`destroy`時のredirect処理で、HTTP statusに302を使用していたのを、303を使用するよう修正しています。302だとHTTP methodに何を使うかがブラウザに委ねられてしまい、`DELETE`が再度使われてしまう(二重削除が行われる)可能性がある為。

参考:[RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110#status.302)