なるようになるブログ

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

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

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

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


Remove tests that limit/offset without order which is non-deterministic result

activerecord/test/cases/relation/update_all_test.rbの修正です。

orderなしでlimit / offsetを指定するテストを削除しています。他のテストで確認出来ている内容の為。


Fix random CI fail due to non-deterministic order

activerecord/test/cases/batches_test.rbの修正です。

assertionで値を比較する際に、値をidでsortしてからチェックするよう修正しています。 sortを指定しないと結果が不定になる為。


Add methods to the public API of ActiveRecord::Inheritance

activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rbactiverecord/lib/active_record/inheritance.rbの修正です。

ActiveRecord::InheritanceSTI、Polymorphic associationのクラス名を取得する際に使用するpublic API(sti_class_forpolymorphic_class_for)を追加しています。

このpublic APIをオーバーライドすることで、STI / Polymorphic assertionのクラス名取得の挙動を拡張する、という事が出来るようになっています。例えば、STI / Polymorphic associationのクラス名を変更するような場合に変更前の名前での変換も出来るようにするように挙動を上書きする、ような事が出来ます。