なるようになるブログ

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

rails commit log流し読み(2017/11/20)

2017/11/20分のコミットです。

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


Generate keys instead of keys_to_names

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

RedisCacheStore#read_multi_mgetメソッドでmgetする際にnameとノーマライズしたkeyのペアのHashを生成していたのを、keyの配列だけ生成するよう修正しています。ペアで使用する事が無かった為。


Fix ASt CI failure with rack-test 0.7.1

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

UploadedFileを使用したテストで、Rack::Test::UploadedFile.newの引数にPathnameインスタンスを渡していたのを、pathのStringを渡すよう修正しています。

rack-test 0.7.1からPathnameインスタンスを渡せなくなってしまった為のようです。

参考:Add the ability to create Test::UploadedFile instances without the fi…


Fix test_session_store_with_expire_after failure with rack-test 0.7.1

actionpack/test/dispatch/session/cookie_store_test.rbの修正です。

cookieの指定が不足していた部分があったのを修正しています。こちらもrack-test 0.7.1の影響。


Prevent extra spawn to make klass.all faster (#29009)

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

klass.allを使用した際に、spawnの呼び出しを減らせるようリファクタリングしています。

一部抜粋。

-            relation.where(type_condition).create_with(inheritance_column.to_s => sti_name)
+            relation.where!(type_condition)
+            relation.create_with!(inheritance_column.to_s => sti_name)

wherecreate_withの代わりにwhere!create_with!を使用して、自身を直接変更するようにしています。高速化の為。STIを使用している場合、30%程度allがはやくなっているとの事です。


Permit attaching files to new records

activestorage/lib/active_storage/attached/many.rbactivestorage/lib/active_storage/attached/one.rbの修正です。

新規に作成したオブジェクト(まだレコードが保存されていない)からattachmentsを参照した場合、エラーになってしまうバグがあったのを修正しています。


Merge pull request #31170 from PHedkvist/system_testing_guides

rails guideのA Guide to Testing Rails Applicationsの修正です。

System Testingの項に、headless_chromeを使用する場合の設定方法について追記しています。


Pass over Execution guide[ci skip]

rails guideのThreading and Code Execution in Railsの修正です。

guide全体のグラマー、タイポの修正を行っています。