なるようになるブログ

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

rails commit log流し読み(2014/09/08)

2014/09/08分のコミットです。

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


Convert string concatenations to substitutions

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

Stringの連結をする際、 "+"で連結をしていたのを、ダブルコーテーションを使う形に統一しています。

-              ('add_index ' + remove_prefix_and_suffix(index.table).inspect),
+              "add_index #{remove_prefix_and_suffix(index.table).inspect}",

Prefer "if any?" to "unless empty?"

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

"unless empty?"を"if any?"に修正しています。可読性の向上の為ですかね。


Fix warnings for undefined local variable

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

未定義の変数を使用してwarningが出ていたのを修正しています。


Schema dumper: all connection adapters implement #primary_key, so rely on it exclusively

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

primary keyを取得する為に、primary_key_forというメソッドを作成し、そこで取得の為の処理を定義していたのですが、@connection.primary_keyで取得出来るとの事で、メソッドを削除しています。


Removing unused fake models

actionpack/test/lib/controller/fake_models.rbの修正です。

使用していないclassを削除しています。


Merge pull request #16825 from cristianbica/fix-ar-nested-arrays

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

4.1.x系では、User.where(id: [[1,2],3])User.where(id:[1, 2, 3])と等価だったのですが、4.2で動作しなくなってしまっていたので、動作するよ修正しています。

なお、上記のようなnested arrayはdeprecateとの事なので、今後は自分でFlattenしてあげる必要があります。


Merge pull request #16827 from kuldeepaggarwal/f-disable-migration-logging

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

ActiveRecordのSchemaのテストの際は、マイグレーションのログを出力しないよう対応しています。