なるようになるブログ

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

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

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

CHANGELOGへの追加はありませんでした。


Merge pull request #35182 from jhawthorn/db-selection-refactor

activerecord/lib/active_record/middleware/database_selector.rbactiverecord/lib/active_record/middleware/database_selector/resolver.rbの修正です。

ActiveRecord::Middleware::DatabaseSelectorでDBの切り替え処理を行うclass / objectを保持する変数名に、operationという名称を使用していたのを、contextという名称を使用するよう修正しています。

operationだと違う意味(DBの操作的な意味)に捉えられてしまう為。


Merge pull request #35187 from jhawthorn/db-selection-resolver_context

activerecord/lib/active_record/railtie.rbrailties/lib/rails/generators/rails/app/templates/config/environments/production.rb.ttの修正です。

先の変数名の変更処理(operation -> context)で修正が漏れていた箇所があったのを修正しています。


Address test_belongs_to_does_not_use_order_by failure due to checking order by for metadata queries

activerecord/test/cases/associations/belongs_to_associations_test.rbactiverecord/test/cases/associations/has_one_associations_test.rbの修正です。

belongs_to / has_oneでorder byが使用されない事を確認するテストで、全てのqueryに対してチェックを行っていたのを、metadata queryについてはチェックしないよう修正しています。metadata queryにorderが含まれてしまう事がある為。


Refactor extracting current_scope_restoring_block into the scoping class

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

relation.newで行っていたscopeのリストア処理をScoping classで行うよリファクタリングしています。


Bugfix has_many association #size when ids reader is cached and association is changed

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

has_many associationを使用している場合に、ids readerのcacheがassociation変更後も破棄されず、結果sizeが正しい値を返さない事があるバグがあったのを修正しています。


Fix relation.exists? with giving both distinct and offset

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

distinct / offsetと合わせて使用した場合に、relation.exists?(とrelation.empty?)が正しい値を返さないバグ(1 AS oneの置き換えでdistinctorderが失われていた)があったのを修正しています。