なるようになるブログ

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

rails commit log流し読み(2016/11/16)

2016/11/16分のコミットです。

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

activerecord/CHANGELOG.md


Refactor NullRelation#calculate

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

ActiveRecord::NullRelation#calculateメソッドでif / elsifで分岐処理を定義していたのを、case / whenを使用するようリファクタリングしています。


Fix testing isolation

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

ActiveSupport::Testing::Isolationでテスト実行用の引数を組み立てる際に、テスト名をShellwords.escapeでescapeするよう修正しています。

-              test_opts = "-n#{self.class.name}##{self.name}"
+              test_opts = "-n#{self.class.name}##{Shellwords.escape(self.name)}"

テスト名にシングルクォートが含まれている事があり、そのまま使用してしまうとunexpected EOF while looking for matching''`でエラーになってしまう為。


Support AC::Parameters for PG HStore

activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rbの修正です。

Postgres HStoreを使用しているattributeにActionController::Parametersインスタンスを渡してデータを保存しようとした場合に、TypeErrorが発生してしまうバグがあったのを修正しています。


docs, add update_all example with SQL fragment. [ci skip]

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

ActiveRecord::Relation#update_allのdocに、update_allSQL fragmentを使用した場合のexampleを追加しています。

# Update all invoices and set the number column to its id value.
Invoice.update_all('number = id')