2021/12/21分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Fix
QueryMethods#in_order_of
to handle empty order list. - Add a deprecation warning when
prepared_statements
configuration is not set for the mysql2 adapter. - Fix migration compatibility to create SQLite references/belongs_to column as integer when migration version is 6.0.
update delete example using turbo
rails guideのGetting Started with Rails
の修正です。
Deleting an Article
の項にあるデータ削除のexamleコードを、Turboを使う前提のコードに修正しています。
Revert "Merge pull request #43604 from nikonoid/bug/31722"
ActiveRecord::Migration next_migration_number
でmigration numberの生成を行う際に値の比較をIntegerに変換してから行うよう修正した、 ActiveRecord::Migration next_migration_number should use numeric version comparison.をRevertしています。breaking changeになってしまったのと、timestamped migrationsのフォーマットにちゃんと従っていれば不要な対応の筈の為。
railties/test/generators/plugin_generator_test.rb
の修正です。
rails new
に現在は存在しないオプションを使用したテストがあったのを削除しています。
Make sure plugin generator works with dummy app
railties/lib/rails/generators/app_base.rb
、
railties/lib/rails/generators/rails/plugin/templates/Gemfile.tt
の修正です。
dummy applicationのGemfile
にsprockets-rails
を追加するよう修正しています。dummy applicationはsprocketsにまだ依存しており、gemが無いとエラーになってしまう為。
Merge pull request #43900 from yykamei/initialize-with-logging_context
actionpack/lib/action_controller/metal/strong_parameters.rb
の修正です。
ActionController::Parameters
の一部メソッド実行時に、元々インスタンスで保持していたaction名やcontroller名のコンテキストが失われしまうバグがあったのを修正しています。
Fix logger format with Ruby 3.1
activesupport/test/clean_logger_test.rb
の修正です。
Ruby 3.1でloggerのformatが変更になった事によりエラーになってしまたテストがあったのを修正しています。
Merge pull request #43811 from eikes/migrations-guide-foreign-key-deferrable
rails guideのActive Record Migrations
の修正です。
add_foreign_key
メソッドについて説明している箇所について、API docへのリンクの追加、不要なオプションの削除等を行っています。
Merge pull request #43914 from orhantoy/add-only-numeric-option-to-numericality-validator
activemodel/lib/active_model/validations/numericality.rb
の修正です。
numericality validatorに、numericな値だけかどうかをチェックする為のonly_numeric
オプションを追加しています。only_numeric
がtrueの場合、"120"
のようなnumericに変換すると正常な値だけどStringな値が指定された場合エラーになるようになっています。
Merge pull request #43916 from Shopify/activerecord-in-order-of-empty-array
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
QueryMethods#in_order_of
のorder listに空の配列を指定した場合、実行時にエラーになってしまっていたのを、エラーにならないよう修正しています。空の配列が指定された場合、デフォルトのorderingが使用されるようになっています。
Merge pull request #43918 from ghiculescu/link-to-model-twice
actionview/lib/action_view/helpers/url_helper.rb
の修正です。
link_to
にmodelを引数に2回渡した場合(e.g. link_to @article, @article
)にエラーになってしまうバグがあったのを修正しています。
activerecord/lib/active_record/reflection.rb
の修正です。
polymorphic relationship をthroughしてjoin処理を行った場合に、エラーになってしまうバグがあったのを修正しています。
actionview/lib/action_view/helpers/url_helper.rb
の修正です。
button_to
にblock + HashでURLを指定した場合に、誤った内容のbutton tagが生成されてしまうバグがあったのを修正しています。
actionview/lib/action_view/helpers/url_helper.rb
の修正です。
Merge pull request #43918 from ghiculescu/link-to-model-twice で必要な変数の初期化処理を削除してしまっていたのを戻しています。
Keep the comments in the generate application consistent
railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
の修正です。
rails new
で生成されるファイル内のコメントの末尾にピリオドを追加しています。
activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
の修正です。
mysql2 adapterでprepared_statements
が設定されていない場合、Rails 7.2ではデフォルト値がtrueに変わる旨メッセージを表示するよう修正しています。他のadapter(sqlite3、postgresql)ではデフォルトtrueになっており、挙動を合わせる為。
activerecord/lib/active_record/migration/compatibility.rb
の修正です。
SQLite adapterで、Rails 6.0で作成したreferences/belongs_toを使用したmigrationファイルをRails 6.1以降で実行すると生成されるスキーマが変わる(元々外部キーのカラムにintegerを使っていたのがbigintに変わってしまう)バグがあったのを修正しています。
Ruby 3.1: Handle Class#subclasses
existing without Class#descendants
Active Supportの修正です。
Ruby 3.1で本体に含まれる予定だったClass#descendants
メソッドの本体への追加がRevertされました。しかし、Class#subclasses
は予定通り追加されており、Ruby本体にClass#subclasses
がある、しかし、Class#descendants
は無い、という状態でもそれぞれのメソッド、及び、DescendantsTracker
が動作するよう処理を修正しています。
Fix a mistake in DescendantsTracker#descendants for Ruby 3.1
activesupport/lib/active_support/descendants_tracker.rb
の修正です。
DescendantsTracker#descendants
で変数名をタイポしていたのを修正しています。
Fix typo in #to_s deprecation in 7.0 release notes
rails guideのRuby on Rails 7.0 Release Notes
の修正です。
#to_s
メソッドをdeprecateにした対応について、参考リンクのフォーマットがおかしかったのを修正しています。