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
が呼び出されるようになっている為。