なるようになるブログ

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

rails commit log流し読み(2019/10/02)

2019/10/02分のコミットです。

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

activestorage/CHANGELOG.md


Redis cache store: fail gracefully when max clients reached

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

Redis cache storeでclient接続数が最大数を越えた場合のエラーの際に、fallback処理が正しく呼ばれないバグがあったのを修正しています。


List activesupport as a direct dependency

Action Cable、Action Mailer、Active Storageのgemspecに、dependencyとしてactivesupportを追加しています。

元々他のコンポーネント経由で追加されていた為問題は無かったのですが、直接使用しているコンポーネントなので明示的に追加されていた方が良いだろう、という事で追加されています。


Allow configure services for individual attachments

Active Storageの修正です。

Active Storageのサービスはattachment毎に指定出来るよう修正しています。

class User < ActiveRecord::Base
  has_one_attached :avatar, service: :s3
end

class Gallery < ActiveRecord::Base
  has_many_attached :photos, service: :s3
end

基本的にはグローバルの設定が使用され、その設定を上書きしたい場合にのみ指定する必要があります。

この対応の為に、active_storage_blobs tableに使用するサービス名を保存する為のカラム(service_name)が追加されています。アップグレードの場合はカラム追加用のmigrationファイルを実行する必要があります。


Fix failing tests on Active Storage

activestorage/test/controllers/direct_uploads_controller_test.rbの修正です。

先のサービスをattachment毎に指定出来るようにした対応の影響でコケていたテストがあったのを修正しています。


Fix GCS and Azure failing tests on Active Storage

activestorage/test/controllers/direct_uploads_controller_test.rbの修正です。

引き続き先のサービスをattachment毎に指定出来るようにした対応の影響でコケていたテストがあったのを修正しています。


Set Content-Type on variant uploads

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

variant処理を行ったファイルをアップロードする際にもContent-Type headerを指定するよう修正しています。


Require minitest/mock since we rely on stub in this test file

activestorage/test/models/variant_test.rbの修正です。

不足していたminitest/mockのrequireを追加しています。


Reverse assertion arguments: expected, actual

activestorage/test/models/variant_test.rbの修正です。

assert_equalの引数の順番をexpected, actualになるよう修正しています。


Update Gemfile.lock with newly added activesupport dependencies

Gemfile.lockの修正です。

List activesupport as a direct dependency でActive Supportのdependencyを追加した際にGemfile.lockの更新が漏れていたのを対応しています。


Remove unused require

activerecord/lib/active_record/scoping/named.rbの修正です。

使用していないactive_support/core_ext/hash/exceptのrequireを削除しています。


Fixed typo in attachment service test description. custom_ ervice -> custom service [ci skip]

activestorage/test/models/attached/many_test.rbの修正です。

テストメソッド名をタイポしていたのを修正しています。


Removed repeated word 'done' from Active Storage guide [ci skip]

rails guideのActive Storage Overviewの修正です。

has_many_attachedの項のタイポを修正しています。


update package.json files to use https homepage value

コンポーネントpackage.json内のhomepageのリンクを全てhttpsに修正しています。


Add docs about _scopes option on enum. [ci skip]

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

enumのdocに_scopesオプションについての説明を追加しています。