2018/08/31分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activejob/CHANGELOG.md
Refactor attributes_for_{create,update} to avoid an extra allocation
activerecord/lib/active_record/attribute_methods.rb、
activerecord/lib/active_record/persistence.rbの修正です。
attributes_for_updateメソッド、及び、attributes_for_createメソッドでreadonly attributeを除外するのにrejectを使用していたのを、delete_ifメソッドを使用するようリファクタリングしています。余分なオブジェクトの生成を減らせるようにする為。
Add migrations_paths option to migration generator
activerecord/lib/rails/generators/active_record/migration.rb、
activerecord/lib/rails/generators/active_record/migration/migration_generator.rbの修正です。
migration generatorにmigrationファイルを生成するpathを指定する為の--migrations_pathsオプションを追加しています。
$ rails g migration CreateHouses --migrations_paths=db/kingston_migrate
invoke active_record
create db/kingston_migrate/20180830232057_create_houses.rb
複数DBを使っていて、migrationファイルをDB毎にわけたい時に使用する為に追加したとのことです。
[ci skip] Document permitted_scalar_filter
actionpack/lib/action_controller/metal/strong_parameters.rbのdocの修正です。
Parameters#permitted_scalar_filterメソッドにdocを追加しています。
Merge pull request #33637 from eileencodes/ar-connection-management-refactoring
Active Recordの修正です。
ActiveRecord::Base.configurationsの戻り値が元々はHashだったのを、ActiveRecord::DatabaseConfigurationsクラスのインスタントを返すよう修正、及び、関連している箇所の修正を行っています。
# before ActiveRecord::Base.configurations #=> { "development" => { "adapter" => "sqlite3", "database" => "db/development.sqlite3" } } # after ActiveRecord::Base.configurations #=> <ActiveRecord::DatabaseConfigurations:0x00007fd1acbdf800 @configurations=[ #<ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fd1acbded10 @env_name="development", @spec_name="primary", @config={"adapter"=>"sqlite3", "database"=>"db/development.sqlite3"}> ]
ActiveRecord::DatabaseConfigurationsにはto_hメソッドがあり、元と同じようなHashが必要な場合、to_hメソッドを使用すれば取得出来るようになっています。複数DB対応の為のリファクタリング。今のところ完全に非互換な対応なので、ActiveRecord::Bae.configurationsを使用している場合注意が必要そうです。
Just delegate update with ids on a relation to klass.update
activerecord/lib/active_record/relation.rbの修正です。
Relation#updateメソッドの引数に、idsとattributesを指定した場合に、指定したidに対して更新処理が行われるよう修正しています。
これは、Refactor attributes_for_{create,update} to avoid an extra allocationから出来なくなっていた挙動だったのですが、そもそもidsとattributesを指定した場合の挙動は保証されていませんでいた(ドキュメントに記載はなかった)。
が、どうもその挙動を期待していたコードが(Shopifyの)あった為、再度動作するよう修正しています。
Merge pull request #33751 from steves/add_retry_notifications_to_aj
activejob/lib/active_job/exceptions.rb、
activejob/lib/active_job/logging.rbの修正です。
Active Jobのinstrumentation hookに、enqueue_retry.active_job、retry_stopped.active_job、discard.active_jobを追加しています。
名前の通り、retry jobがenqueueされた時、retry jobがstopした時、jobがdiscardされた時に、それぞれ実行されるようになっています。
[ci skip] Typo in form helpers guide
rails guideのAction View Form Helpersの修正です。
Security GuideをSecuring Rails Applicationsに修正しています。
activerecord/test/cases/dirty_test.rb、
activesupport/test/metadata/shared_metadata_tests.rbの修正です。
テストの後処理でtravel_backを呼び出していたのを削除しています。Remove time stubs after each test以降、テストの後処理で自動でtravel_backが呼び出されるようになっている為。