なるようになるブログ

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

rails commit log流し読み(2018/01/11)

2018/01/11分のコミットです。

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md


[ci skip] setting :inverse_of works with :as, :through and :polymorphic options, and is needed for bi-directionality with a scope

activerecord/lib/active_record/associations.rbのdoc、及び、rails guideのActive Record Associationsの修正です。

:inverse_of:as:throughオプションを指定した場合に動作しない旨説明が記載されていたのですが、実際は動作するようになっているので、その旨説明を修正しています。


Extract Analyzable and Representable concerns

Active Storageの修正です。

ActiveStorage::Blobクラスの中で定義されていた analyze / representation等に関する処理をmodule(Analyzable / Representable)に切り出しています。


Correct comment [ci skip]

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

ActiveStorage::Blob::Representable#variantメソッドのdoc内でメソッド名をタイポしていたのを修正しています。


Add missing # frozen_string_literal: true

Active Storageの修正です。

先ほど追加したAnalyzable / Representable moduleの先頭にfrozen_string_literal: trueが不足していたのを追加しています。


Update error names in docs [ci skip]

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

先のmoduleの切り出しの影響によりUnpreviewableErrorクラスのnamespaceが変更になっていたのですが、docが古いままになっていたので修正しています。


Make relation.exists? more performant when using eager loading

activerecord/lib/active_record/relation/finder_methods.rbの修正です。

eager load + relationに対するexists?メソッドを実行した場合に、不要なSELECT queryが実行されてしまっていたのを、実行されないよう修正しています。


Use apply_join_dependency instead of meaningless named find_with_associations

activerecord/lib/active_record/relation.rbactiverecord/lib/active_record/relation/finder_methods.rbの修正です。

Relation#to_sqlメソッドでJoinDependencyを組み立てるのにfind_with_associationsという名前のメソッドを使用していたのを、apply_join_dependencyメソッドを使用するよう修正しています。

find_with_associationsという名前にも関わらず、やっている事は JoinDependencyの組み立てだけで、findingに関する処理は無かった為、名前と処理が一致していませんでした。ただ、JoinDependencyとrelationを返してもらう必要はあった為、apply_join_dependencyの方でそれらを返せるようにし、find_with_associationsメソッドは削除しています。


Remove the deprecated :conditions option in INVALID_AUTOMATIC_INVERSE_OPTIONS

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

deprecateになっていたINVALID_AUTOMATIC_INVERSE_OPTIONS:conditionsオプションを削除しています。


Fix typos [ci skip]

各guideのタイポ、不要なスペース等をまとめて削除しています。


Merge pull request #23146 from piotrj/issue_18424

activerecord/lib/active_record/associations/has_many_through_association.rbの修正です。

has_many :through associationsを使用している場合に、_idsメソッドでidを更新する際、scopeに定義されたコンディションが無視されてしまっていたのを、コンディションを使用するよう修正しています。


Merge pull request #31624 from y-yagi/fix_minitest_511

activesupport/lib/active_support/testing/isolation.rbrailties/lib/rails/test_unit/reporter.rbの修正です。

Minites 5.11でRailsのtest runner、及び、Testing::Isolation moduleが正しく動作していなかったのを、動作するよう修正しています。


Merge pull request #30268 from ignatiusreza/instrumentation

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

ActiveSupport::Cache::Storeクラスのread_multiメソッドに対するinstrumentation hookが実装されていなかったのを、実装しています。


Instrument preview image drawing

activestorage/lib/active_storage/previewer.rbの修正です。

ActiveStorage::Previewer#drawメソッドに対してinstrumentation hookを追加しています。


Instrument image transformation

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

ActiveStorage::Variation#transformメソッドに対してinstrumentation hookを追加しています。