なるようになるブログ

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

rails commit log流し読み(2021/07/29)

2021/07/29分のコミットです。

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

railties/CHANGELOG.md

activejob/CHANGELOG.md

activestorage/CHANGELOG.md

actionview/CHANGELOG.md

actionmailbox/CHANGELOG.md


Merge pull request #42626 from Shopify/as-file-store-remove-local-cache

activesupport/lib/active_support/cache/file_store.rbactivesupport/test/cache/stores/file_store_test.rbの修正です。

FileStoreからLocalCacheを削除しています。

LocalCacheはdeserialized valueをメモリに保持する為に使用されています。元々、LocalCacheは入力された値をそのまま使用していた(入力値を変更していた)のを、Rails 6.1でdupするよう修正しました。この影響により、LocalCacheの処理の性能がRails 6.0より悪くなってしまっていました。LocalCacheを使用していたFileStoreも性能悪化してしまっていたのですが、そもそもFileStoreLocalCacheの処理が不要な筈、という事で、性能改善の為にLocalCacheを使用しないよう修正しています。


Remove "stupid" from active record

activerecord/lib/arel/visitors/mysql.rbactiverecord/test/cases/scoping/default_scoping_test.rbの修正です。

使用しないで良い箇所でstupidという単語を使っている箇所があったのを修正しています。


Fix incomplete :nodoc: directives [ci-skip]

docの修正です。

:nodoc::nodocにタイポしていたのを修正しています。


Apply :nodoc: to all DatabaseStatements overrides [ci-skip]

docの修正です。

内部だけで使用する想定のmoduleに:nodoc:を指定しています。


Add more detail about what hosts are allowed

actionpack/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erbactionpack/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erbの修正です。

host blockによりエラーになった場合のエラーメッセージに、hostnameが有効なhostnameかどうかを確認してね、というメッセージを含むよう修正しています。


Merge pull request #42867 from sato11/rename-middleware-remove

Add Middleware#remove to delete middleware or raise if not found.のフォローアップとして、CHANGELOGの修正、docの修正等を行っています。


Move Active Storage JS to ESM and drop Babel transpiling (#42895)

Acitve Storageの修正です。

Active StorageのJSをES modulesに変更しています。互換性の為、activestorage.jsは元の通りUMDとなっており、別途ES modulesのactivestorage.esmを追加しています。


Remove offensive wording from active record

activerecord/lib/active_record/reflection.rbのdocの修正です。

攻撃な言葉(This shit is nasty)をdocから削除しています。


No underscore style (#42898)

Action Textの修正です。

Action TextのJSをaction_text.js -> actiontext.jsに修正しています。Active StorageのJSと合わせる為。


Update resolve_link_as to include SVG (#42892)

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

preload_link_tagSVGファイルのtypeimage/svg+xmlになるよう修正しています。


Merge pull request #41442 from p8/improve-help-for-rake-tasks

railties/lib/rails/command.rbの修正です。

rails commandのhelpを表示する際に、rake taskのdescriptionも表示するよう修正しています。


Add plugin to common command USAGE (#41457)

railties/lib/rails/commands/help/USAGEの修正です。

command helpにplugin new commandを含むよう修正しています。


retry_on parameter attempts now accepts :unlimited (#41761)

activejob/lib/active_job/exceptions.rbの修正です。

Active Jobの修正です。

retry_onattemptsを無制限に行えるよう修正しています。無制限にしたい場合、attempts:unlimitedを指定すればOKです。

class MyJob < ActiveJob::Base
  retry_on(AlwaysRetryException, attempts: :unlimited)
end

Merge branch 'vips-as-default' into main

Active Storage、railtiesの修正です。

新規に作成したアプリの場合、Active Storageのvariant processorvipsを使用するよう修正しています。合わせて、doc内のprocessのexampleをvipsを使った場合のexampleに修正しています。


Merge pull request #42819 from alexcwatt/docs-representable

activestorage/app/models/active_storage/blob/representable.rbactivestorage/lib/active_storage/transformers/image_processing_transformer.rbの修正です。

transform処理について説明している箇所が、ImageMagickが使われる事を前提とした説明になっていたのを修正しています。


Merge pull request #42030 from diegotoral/configurable-default-option

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

config_accessordefault値を指定出来るよう修正しています。

class User
  include ActiveSupport::Configurable
  config_accessor :allowed_access, default: false
end

User.allowed_access # => false

Merge pull request #41822 from benoittgt/better-error-message-InvalidAuthenticityToken

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

ActionController::InvalidAuthenticityTokenが発生した場合に、ActionController::InvalidAuthenticityTokenのmessageに何故CSRF tokenエラーが発生したかの情報を保持するよう修正しています。


Merge pull request #42515

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

associationの定義が無いattachment(attachment保存後にmodelのassociationの指定を変更した場合)を削除しようとするとエラーになっていたのを、削除出来るよう修正しています。


Merge pull request #42358 from ghiculescu/credentials-backwards-compat

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

Allow access to nested secrets by method callsの影響で、ネストしたキーの値が別のHashの場合、値が正しく取得出来なくなってしまっていたのを修正しています。


Merge pull request #41728

Action Viewの修正です。

time_fieldにsecondsを含むかどうかを指定する為のinclude_secondsオプションを追加しています。デフォルトはtrueです(元と同じ挙動)。

<%= form.time_field :foo, include_seconds: false %>
# => <input value="16:22" type="time" />

<%= form.time_field :foo %>
# => <input value="16:22:01.440" type="time" />

Merge pull request #42395 from chexology/fix-file-upload-in-action_mailbox-conductor

actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rbの修正です。

inbound emails conductorでattachmentsをpermitted parametersに含むよう修正しています。unpermitted parameterに関するwarningが出るのを避ける為。


Address bundle exec blade build failure with ruby 3.1.0dev

Gemfileの修正です。

digest gemのバージョンを3.0.1.preに更新しています。Ruby 3.1.0devでバージョンが更新されており、ビルドが通るようにする為。


Fix MemCacheStore local cache duplication

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

MemCacheStore: Properly duplicate local cache values in 6.1 modeでlocal cache valuesを6系までと同様にdupした値を返すようにしたのですが、実際は期待通りの動作していなかった(左記で対応したメソッドは直接呼ばれるメソッドでは無かった)為、対応方法を変えて再度修正しています。


s/octopus/cactus

activesupport/lib/active_support/inflector/inflections.rbのdocの修正です。

irregularのexampleにoctopusを使用していたのを、cactusを使用するよう修正しています。octopusの複数形が何か、というのは議論の余地がある為、との事です。参考: nouns - What is the correct plural of "octopus"? - English Language & Usage Stack Exchange