2022/04/06分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Merge pull request #44833 from ghousemohamed/extend-test-cases-in-ar-for-methods-accepting-blocks
activerecord/test/cases/relations_test.rb
の修正です。
create
やfind_or_create_by
などにblockを指定した場合のテストを追加しています。
Merge pull request #44783 from p8/guides/move-validates-associated
rails guideのActive Record Validations
の修正です。
validates_associated
メソッドの説明を、他のvaliates
系メソッドの説明の近くに移動しています。
Merge pull request #44574 from NobodysNightmare/fix-activestorage-cdn-example
rails guideのActive Storage Overview
の修正です。
CDNから画像を参照する場合のexampleコードに明示的なexpires_in
の指定を追加しています。Rails側の処理が変わった場合にもexpires_in
の指定が行われるようにする為。
Merge pull request #44592 from ghiculescu/remote-ip-docs
actionpack/lib/action_dispatch/middleware/remote_ip.rb
のdocの修正です。
Remote IPのdocについて、言い回しの修正、リンク切れページの修正等を行っています。
Add docs about how to use remote browser in test (#44311)
rails guideのTesting Rails Applications
の修正です。
SeleniumHQ/docker-seleniumのような、remote browserをsystem testで使う方法についての説明を追加しています。
Remove autoload to unused constant
activejob/lib/active_job.rb
の修正です。
存在しない定数に対するautoload
の指定があったのを削除しています。
All intermediate delegation methods should preserve kwargs flag
Ruby 3.2で*rest parameterを指定しているメソッドでkwargs flagを維持しなくなった為、kwargs flagをdelegateしたいメソッドに対して明示的にruby2_keywords
を指定するよう修正しています。
参考: Bug #18625: ruby2_keywords does not unmark the hash if the receiving method has a *rest parameter
Merge pull request #44283 from simbasdad/csrf_token_storage
Action Packの修正です。
CSRF Tokenを保持・取得する処理を独自にカスタマイズ出来るよう修正しています。カスタマイズしたい場合、fetch
、store
、reset
を実装したクラスを作成し、そのクラスをprotect_from_forgery
のstore
オプションにに指定すれば良いようになっています。
class CustomStore def fetch(request) # Return the token from a custom location end def store(request, csrf_token) # Store the token in a custom location end def reset(request) # Delete the stored session token end end class ApplicationController < ActionController::Base protect_from_forgery store: CustomStore.new end
Remove deprecated comparing AC::Parameters with a hash assertion
actionpack/test/controller/parameters/parameters_permit_test.rb
の修正です。
deprecatedになったActionController::Parameters
とHash
の比較処理があったのを削除しています。
Handle renaming of global_constant_state
in Ruby 3.2
activesupport/test/core_ext/enumerable_test.rb
の修正です。
Ruby 3.2で削除されたRubyVM.stat(:global_constant_state)
を使用している箇所があったのを修正しています。