2018/09/27分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Merge pull request #31819 from bpohoriletz/master
activerecord/lib/active_record/associations/preloader.rbの修正です。
Associations::Preloader#preloaders_onメソッドで引数のassociationの値をHash、String等のclassでチェックしていたのを、respond_to?(respond_to?(:to_hash)、respond_to?(:to_str))を使用するよう修正しています。
ActionController::ParametersのようなHashじゃないclassもpreloadに指定出来るようにする為。
Merge pull request #33983 from gmcgibbon/raise_if_fixture_path_blank
activerecord/lib/active_record/fixtures.rbの修正です。
fixture_pathが空の場合に、file systemのrootからファイルのスキャンが行われてしまっていたのを、エラーをraiseするよう修正しています。
Merge pull request #30676 from artofhuman/import-assert-attrs-error-message
activemodel/lib/active_model/attribute_assignment.rbの修正です。
modelのattributesに不正な値を指定した場合のエラーメッセージに、指定された値のclass名を含むよう修正しています。
# before User.new(1) # => ArgumentError (When assigning attributes, you must pass a hash as an argument.) # after User.new(1) # => ArgumentError (When assigning attributes, you must pass a hash as an argument, Integer passed.)
Merge pull request #33970 from rails/eager-url-helpers
Action Packの修正です。
routesの構築が完了した後に、routing helper moduleの構築を全て行うよう修正しています。
これにより、helper moduleを完全にキャッシュする事が出来るようになり(routesの構築が終わっていればhelper moduleも完全に構築された状態である事が保証される為)、それにより、controllerにhelper moduleをincludeする際にキャッシュされたhelper moduleを安全に使用する事が出来るようになっています。
代わりに、routesの完全に構築が終わっていないとhelper moduleを使用出来ない、という制限が入っています。これが問題になるケースはあるのかなあ。
Add ActionCable::Channel::TestCase
Action Cableの修正です。
Channel classのunit-test用のテストクラス(ActionCable::Channel::TestCase)を追加しています。使い方はdoc参照。
Merge pull request #33997 from MatthiasWinkelmann/pg_dump
activerecord/lib/active_record/tasks/postgresql_database_tasks.rbの修正です。
db:structure:dumpでpg_dumpコマンドを実行する際にサポートしてないオプション(-X)を指定してしまっていたのを削除しています。
PostgreSQL adapterでdb系タスクを実行する際に~/.psqlrcファイルを読み込まないよう修正し(ようとし)た、Merge pull request #33906 from dark-panda/ignore-psqlrc-when-using-psqlで、修正する箇所に誤りがあり、結果pg_dumpに不正なオプションを指定するようになってしまっていました。
Use -X when loading structure.sql via psql
activerecord/lib/active_record/tasks/postgresql_database_tasks.rbの修正です。
structure.sqlをload時に、~/.psqlrcファイルを読み込まないよう修正しています。
.psqlrcファイルにユーザの入力が必要なコマンド(e.g. \pset pager)等が定義されている場合に、タスクの実行の妨げになってしまう事がある為、それを避ける為。
Refactor counter cache to extract decrement_counters_before_last_save on the belongs_to association
activerecord/lib/active_record/associations/belongs_to_association.rb、
activerecord/lib/active_record/associations/builder/belongs_to.rbの修正です。
レコード保存時のcounter cacheのdecrement処理をBelongsToAssociationのメソッドで行うようリファクタリングしています。
Added ActionController::Parameters.each_value method
actionpack/lib/action_controller/metal/strong_parameters.rbの修正です。
ActionController::Parametersにeach_valueメソッドを追加しています。Hash#each_valueと同様にハッシュの要素(キーと値)の数だけブロックを繰り返し実行するようになっています。
Avoid extra touch queries when counter cache is updated
activerecord/lib/active_record/associations/builder/belongs_to.rbの修正です。
counter cache更新時に不要なtouch処理によるqueryが発生しないようリファクタリングしています。