なるようになるブログ

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

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

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

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


minor grammar fix [ci skip]

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbのdocの修正です。

add_referenceのメソッドのdoc内のタイポを修正しています。


Let Zeitwerk autoloaders inflect with Active Support

activesupport/lib/active_support/dependencies/zeitwerk_integration.rbの修正です。

Zeitwerk autoloadersでclassをロードする際に、ActiveSupport::Inflectorで指定した内容がロード時に使用されるよう修正しています。


More exercise tests for distinct count with group by

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

distinct count + group byのテストを追加しています。


Add test case for unscope with unknown column

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

unknown columnに対してunscopeした場合のテストを追加しています。


Make this test stronger

railties/test/application/zeitwerk_integration_test.rbの修正です。

Zeitwerk autoloaders + ActiveSupport::Inflectorのテストで、定数が期待通りにロードされている事も確認するよう修正しています。


Merge pull request #35382 from janko/restore-io-copy-stream-compatibility-with-uploaded-file

actionpack/lib/action_dispatch/http/upload.rbの修正です。

ActionDispatch::Http::UploadedFile#to_ioメソッドをtempfileのto_ioを呼び出すよう修正しています。

元々はtempfileへのalasとして定義されていたのですが、Add implicit to path conversion to uploaded fileActionDispatch::Http::UploadedFile#to_pathメソッドが定義された事により、IO.copy_streamActionDispatch::Http::UploadedFileインスタンスを定義できない(IO.copy_streamto_pathが定義されているとto_ioを呼び出す、かつ、to_ioがIOのインスタンスであることを期待するが、tempfileは違う)という問題が発生していました。

元の挙動通り、IO.copy_streamインスタンスを指定出来るようにする為に上記修正を行っています。


How to use select is updated [ci skip]

rails guideのActive Record Query Interfaceの修正です。

Selecting Specific Fieldsの項に、selectの引数にSymbolを指定した場合のexampleを追加しています。


Disable available locale checks in Action Test test

actiontext/test/test_helper.rbの修正です。

Action Textのテストで、I18nのlocale追加時のlocale checkを行わないよう修正しています。

locale checkが有効化されていると、available locale初期化後にlocaleの追加が出来なくなってしまい、テスト内で動的にlocaleを追加する、という事が出来なくなってしまう為。


More exercise string attribute predicate tests for falsy strings

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

string attribute + predicate methodのテストで、falsy stringsを指定した場合のテストを追加しています。


Add test case for unscope with merge

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

unscopemergeを一緒に使用した場合のテストを追加しています。


Remove duplicated protected params definitions

Active Recordの修正です。

テストでprotected paramsが必要な際に、テスト毎に独自のクラスを定義していたのを、support/stubs/strong_parametersを共通で使用するよう修正しています。