なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md


Removed the attribute_accessors required file:

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

使用していないactive_support/core_ext/module/attribute_accessorsのrequireを削除しています。


Also not needed on this file, call to mattr_accessor got removed in https://github.com/rails/rails/commit/9e98f3f7e61dfce0a48948c8d296400af8bfaf21#diff-1ecd313ff0ab827af30014553cf8918dL76

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

使用していないactive_support/core_ext/module/attribute_accessorsのrequireを削除しています。


Make table_name= reset current statement cache

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

table_name=メソッドを呼び出した際に、statement cacheをリセットするよう修正しています。statement cacheがそのままだと、tableを変更したのに古いテーブルに対してqueryが実行されてしまう事があった為。


Remove unused require

各ファイルから使用していないactive_support/core_ext/string/stripのrequireを削除しています。


Deprecate supports_primary_key?

Active Recordの修正です。

supports_primary_key?メソッドをdeprecateにしています。

supports_primary_key?メソッドは名前の通りadapterがprimary keyをサポートしているかどうかチェックするためのメソッドなのですが、既にこのチェック無しにprimary keyを使用していまっている、かつ、全てのadapterでprimary keyはサポートしており、チェックする必要が無い、という事でdeprecateになったようです。


Schema dumping support for PostgreSQL interval type

Active Recordの修正です。

schema dump処理にPostgreSQL interval typeの対応を追加しています。


Schema dumping support for PostgreSQL oid type

schema dump処理にPostgreSQL oid typeの対応を追加しています。


The default arg of index_name_exists? makes to optional

Active Recordの修正です。

index_name_exists?メソッドのdefault引数をオプショナル引数に変更しています。

default引数はadapterがindexをサポートしてない場合にのみ使用する引数なのですが、現状全てのadapterがindexをサポートしており、使用されていない変数の為、渡さないでよいようにする為にオプショナル引数に変更したようです。で、そもそも使用されてないので、後ほどdeprecateにになっています。


Merge pull request #26630 from kamipo/quoted_binary

Active Recordの修正です。

biynaryのquote処理をメソッド(quoted_binary)に切り出して、そちらを使用するよう修正しています。


Deprecate passing default to index_name_exists?

Active Recordの修正です。

index_name_exists?メソッドのdefault引数がdeprecateになっています。理由は先ほど書いたとおり。


Merge pull request #27122 from kamipo/fix_unscope_with_subquery

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

subqueryをunscope出来ないバグがあったのを修正しています。


Refactor test_find_by_does_not_use_statement_cache_if_table_name_is_changed

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

table_name=メソッドを呼び出した際にstatement cacheをリセットされる事を確認するテストで、レコードの再取得をする際に既に作成済みのインスタンスの値を使用するよう修正しています。


Omit redundant using: :btree for schema dumping

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

indexにbtreeを使用している場合に、schemaファイルにusing: :btreeオプションを出力しないよう修正しています。デフォルトでindexはbtreeとして扱われる為、明示的に指定する必要は無いから、ですかねえ。