なるようになるブログ

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

rails commit log流し読み(2023/05/12)

2023/05/12分のコミットです。

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

actionmailer/CHANGELOG.md

actionview/CHANGELOG.md


Add matcher support to assert_enqueued_email_with

actionmailer/lib/action_mailer/test_helper.rbの修正です。

assert_enqueued_email_withメソッドのparams、及び、args引数に、メールの条件を指定するためのProcを指定出来るよう修正しています。

ContactMailer.with(greeting: "Hello").welcome("Cheers", "Goodbye").deliver_later
assert_enqueued_email_with ContactMailer, :welcome,
  params: ->(params) { /hello/i.match?(params[:greeting]) },
  args: ->(args) { /cheers/i.match?(args[0]) }

Fix chmod race condition when generating key

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

encrypted keysの作成と権限の設定処理が別の処理として行われていた都合上、作成~権限の設定の間に任意のユーザがread出来てしまう可能性があったのを、作成と権限の設定処理をまとめて行うようにして、指定外のユーザからのreadが出来ないように修正しています。


Handle non-ASCII-only in AS::MessagePack#signature?

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

ActiveSupport::MessagePack#signature?にASCII以外だけの文字が指定された場合にエラーになってしまっていたのを修正しています。


Merge pull request #48100 from jpbalarini/add-picture-tag-helper

actionview/lib/action_view/helpers/asset_tag_helper.rbの修正です。

HTMLのpictureタグを生成するためのpicture_tagメソッドを追加しています。

<%= picture_tag("picture.webp") %>
<picture>
  <img src="/images/picture.webp" />
</picture>

複数のsourceの指定でも出来るようになっています。

<%= picture_tag("picture.webp", "picture.png", :class => "mt-2", :image => { alt: "Image", class: "responsive-img" }) %>
<picture class="mt-2">
  <source srcset="/images/picture.webp" />
  <source srcset="/images/picture.png" />
  <img alt="Image" class="responsive-img" src="/images/picture.png" />
</picture>

Remove redundant protocol test for url_for

actionpack/test/controller/url_for_test.rbの修正です。

重複して定義されていたurl_forprotocolオプションを指定した場合のテストを削除しています。