2024/07/30分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activemodel/CHANGELOG.md
- Add a load hook
active_model_translation
forActiveModel::Translation
. - Add
raise_on_missing_translations
option toActiveModel::Translation
.
activestorage/CHANGELOG.md
Authentication generator supports an --api
flag (#52442)
railtiesの修正です。
authentication generatorで--api
modeをサポートするよう修正しています。
railties/lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
の修正です。
new
メソッドのexampleコードから明示的な再ログインのための処理を削除しています。ここでわざわざ明示的に記載する必要はないだろう、とのことです。
activemodel/lib/active_model/type/helpers/time_value.rb
、
activemodel/lib/active_model/type/helpers/timezone.rb
の修正です。
fast_string_to_time
メソッドについて、Ruby 3.2.0にあるバグのためのコードをメソッド定義時に必要かどうかをチェックし、不要なバージョンではバグのためのコードを含まないよう修正、及び、最新のRubyだと不要な文字列のフォーマットのチェック処理を行わないよう修正しています。
Add bin/dev by default (#52433)
railties/lib/rails/generators/rails/app/templates/bin/dev.tt
の修正です。
新規にアプリケーションを作成した場合に、bin/dev
ファイルを生成するよう修正しています。中身はbin/rails server
を実行しているだけです。jsbundling やimportmapsでbin/dev
を使用するようになっており、同じようにdev modeを起動出来るようにするため。
docs: use as_json
per method instead of to_json
activesupport/lib/active_support/time_with_zone.rb
のdocの修正です。
as_json
メソッドのdoc内のexampleコードでto_json
を使用していたのを、as_json
を使用するよう修正しています。
Merge pull request #52384 from fatkodima/custom-batch-columns
Active Recordの修正です。
batch系のAPIで、cursor columnを指定出来るよう修正しています。
Product.in_batches(cursor: [:shop_id, :id]) do |relation| # do something with relation end
Change ActiveModel human_attribute_name to raise an error
activemodel/lib/active_model/translation.rb
、
activesupport/lib/active_support/i18n_railtie.rb
の修正です。
ActiveModel::Translation
にraise_on_missing_translations
オプションを追加しています。このオプションがtrueの場合、指定されたattributeのtranslationが存在しない場合にhuman_attribute_name
がexceptionをraiseするようになっています。
Post.human_attribute_name("title") # => Translation missing. Options considered were: (I18n::MissingTranslationData)
なお、config.i18n.raise_on_missing_translations
がraise_on_missing_translations
に設定されるようなっているため、config.i18n.raise_on_missing_translations
がtrueの場合はraise_on_missing_translations
もtrueになるようになっています。
合わせて、ActiveModel::Translation
がloadされたときに実行されるactive_model_translation
hookを追加しています。
Merge pull request #50838 from fractaledmind/ar-fix-sqlite-table-structure-parsing
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
の修正です。
SQLite3 adapterで、columnの定義にfunctionを使用している、かつ、functionにカンマが含まれているような場合(e.g. t.virtual :mutated_name, type: :string, as: "REPLACE(name, 'l', 'L')"
)に、テーブル定義にそのfunctionが正しく反映されないバグがあったのを修正しています。
Improve InvariableError, UnpreviewableError and UnrepresentableError message
activestorage/app/models/active_storage/blob/representable.rb
の修正です。
ActiveStorage::InvariableError
、ActiveStorage::UnpreviewableError
、及び、ActiveStorage::UnrepresentableError
のエラメッセージにBlob IDとcontent_typeを含むよう修正しています。