2019/03/30分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activemodel/CHANGELOG.md
Action Pack、Action Viewの修正です。
annotatedをannotedにタイポしていたのを修正しています。
Rename i18n_full_message config option to i18n_customize_full_message
Active Modelの修正です。
ActiveModel::Errors#full_messageメソッドで出力エラーのフォーマットを変更するかどうかのconfig名を、i18n_full_messageからi18n_customize_full_messageに変更しています。i18n_customize_full_messageの方が意図がわかりやすいだろう、との事です。
Add Active Model release notes for Rails 6 [ci skip] (#35790)
rails guideのUpgrading to Rails 6.0の修正です。
Active ModelのNotable changesを追加しています。
Merge pull request #35781 from excid3/rich_text-field-generator
railtiesの修正です。
model generatorにrich_text fieldを指定出来るよう修正しています。rich_text fieldを指定すると、has_rich_textが指定されたmodelが生成されるようになっています。
$ ./bin/rails g model message content:rich_text
invoke active_record
create db/migrate/20190329223453_create_messages.rb
create app/models/message.rb
invoke test_unit
create test/models/message_test.rb
create test/fixtures/messages.yml
$ cat app/models/message.rb
class Message < ApplicationRecord
has_rich_text :content
end
Fixed the test description for i18n-customize-full-message after rename in #35789
activemodel/test/cases/railtie_test.rbの修正です。
Rename i18n_full_message config option to i18n_customize_full_messageの変更に合わせて、テスト名もi18n full messageからi18n customize full messageに修正しています。
Type cast falsy boolean symbols on boolean attribute as false
activemodel/lib/active_model/type/boolean.rbの修正です。
booleanとして扱う値にSymbol(:false、:FALSE等)も含むよう修正しています。
元々Symbolは含まれてfalse, 0とStringの値だけでした。ただ、query実行時にboolean attributeのcast処理を行うようにした、Ensure casting by boolean attribute when queryingの影響で、PostgreSQLで元々動作していたSymbolの値を指定してのqueryの実行(e.g. where(value: :false))が正しく動作しなくなりました(:falseがTRUEとして扱われる為)。
Symbolを指定するのはただの開発者の指定ミス(ユーザが入力した値はStringになるのでSymbolで値が指定される事は無い)なのですが、:falseがTRUEと判定されてしまうのは望ましい挙動では無いだろう、という事でSymbolの値もbooleanとして扱うよう修正しています。
Add ActiveRecord::Relation#extract_associated for extracting associated record (#35784)
activerecord/lib/active_record/querying.rb、
activerecord/lib/active_record/relation/query_methods.rbの修正です。
relationからassociationのrecordを抽出する為のActiveRecord::Relation#extract_associatedメソッドを追加しています。
account.memberships.extract_associated(:user) # => user recordのcollectionが取得出来る # => `account.memberships.preload(:user).collect(&:user)` のショートハンド
[ci skip] Updated docs to reflect index: true option not available as column modifier
rails guideのActive Record Migrationsの修正です。
Column Modifiersの項に、change_column、add_columnに指定出来ないオプションについての説明があったのを削除しています。
[ci skip] Add ActiveRecord::Relation#extract_associated method to the active_record_querying.md
rails guideのActive Record Query Interfaceの修正です。
Retrieving Objects from the Databaseの項にあるfinderメソッドの一覧にextract_associatedメソッドを追加しています。
fixes eager loading edge case in :zeitwerk mode
Active Supportの修正です。
autoloaderにzeitwerkを使用している場合に、config.autoload_pathsに指定されている、かつ、config.eager_load_pathsに指定されていないディレクトリがeager loadの対象になってしまうバグがあったのを修正しています。
optimizes eager loading in :zeitwerk mode
railties/lib/rails/engine.rbの修正です。
autoloaderにzeitwerkを使用している場合に、engineのeager loadは行わないよう修正しています。
初期化処理でengineのeager load pathsはActiveSupport::Dependencies.autoload_pathsにシフトされており、この時点でeager load pathsは空になっている為。
[ci skip] Fix typo directores -> directories
railties/test/application/zeitwerk_integration_test.rbの修正です。
directoriesをdirectoresにタイポしていたのを修正しています。
Specify Active Storage's dependency on Active Job
activestorage/activestorage.gemspecの修正です。
Active StorageのdependencyにActive Jobを追加しています。Active Storageの中でActive Jobを使用している為。
Require railties for all Active Storage dependencies
activestorage/lib/active_storage/engine.rbの修正です。
依存しているなライブラリのrailtieを最初に読み込むよう修正しています。