なるようになるブログ

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

rails commit log流し読み(2017/08/13)

2017/08/13分のコミットです。

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

activesupport/CHANGELOG.md


Test for the new exception of delegate_missing_to (#30191)

activesupport/lib/active_support/core_ext/module/delegation.rbの修正です。

Module#delegate_missing_toメソッドで、targetがnilの場合、DelegationErrorをraiseするよう修正しています。


Merge pull request #30209 from kamipo/remove_duplicated_table_name

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

PolymorphicReflection#table_nameRuntimeReflection#table_nameメソッドを削除しています。親クラスのAbstractReflection#table_nameと実装が同じで、親クラスのメソッドを使えば済むため。


Use references to respect primary key type in active storage tables

activestorage/db/migrate/20170806125915_create_active_storage_tables.rbの修正です。

record_idblob_idを格納するカラム名の型がintegerになっていたのを、referencesメソッドを使用するよう修正しています。

PostgreSQL / MySQLではprimary keyの型はbigintになっている等adapter毎にprimary keyの型が違う為、adapterに合わせた適切な型が使用されるようreferencesメソッドを使用しています。


Delegate to Enumerable#find for CollectionProxy

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

CollectionProxy#findメソッドで、引数にblockが与えられた場合に、単純にsuperを呼び出すだけに済むようりファクリングしています。

RellationEnumerableをincludeしており、superを呼べばEnumerable#findが使える為。


Merge pull request #30079 from kamipo/move_test_not_compatible_with_serialize_macro

activerecord/test/cases/adapters/postgresql/json_test.rbactiverecord/test/cases/json_shared_test_cases.rbの修正です。

PostgresqlJSONSharedTestCasesに定義されていたtest_not_compatible_with_serialize_macroJSONSharedTestCasesクラスに移動しています。

MySQLの方のJSONテスト用のクラス(Mysql2JSONTest)でもテストが実行されるようにする為。


Fix random CI failure due to non-deterministic sorting order

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

assertionで値を比較する際に、値をidでsortするよう修正しています。

sortを指定していと結果が不定になり、seedによってはテストが失敗してしまう為。


Merge pull request #30211 from koic/frozen_activestorage

Active Storageの修正です。

各ファイルの先頭にfrozen_string_literal: trueを指定、及び、 Stringを変更する箇所でdupを呼び出す等行い、エラーにならないよう対応しています。


Wait for the Delayed Job worker thread to finish

activejob/test/support/integration/adapters/delayed_job.rbの修正です。

Delayed Jobのworkerを停止する際に、スレッドが終わるまで処理をまつよう修正しています。


Use frozen string literal in guides/

guidesディレクトリ配下のファイルの先頭にfrozen_string_literal: trueを指定しています。


Use frozen string literal in tasks/

tasksディレクトリ配下のファイルの先頭にfrozen_string_literal: trueを指定しています。


Use frozen string literal in tools/

toolsディレクトリ配下のファイルの先頭にfrozen_string_literal: trueを指定しています。


Use frozen string literal in ci/

ciディレクトリ配下のファイルの先頭にfrozen_string_literal: trueを指定しています。


Use frozen string literal in root files

ルートディレクトリ配下のファイルの先頭にfrozen_string_literal: trueを指定しています。