2022/12/09分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
actiontext/CHANGELOG.md
- Support
strict_loading:option forhas_rich_textdeclaration - Focus rich-text editor after calling
fill_in_rich_text_area
Ensure query_constraints_list is empty if primary_key is nil
activerecord/test/cases/persistence_test.rbの修正です。
primary_keyがnilの場合、query_constraints_listは空になっている事を確認するテストを追加しています。
Fixed form helper documentation [ci-skip]
rails guideのAction View Form Helpersの修正です。
The fields_for Helper :index Optionの項の言い回しを修正しています。
Move calls on Base connection to methods for rake tasks
Active Recordの修正です。
rake task内のconnection取得処理(Base.connection、及び、Base.establish_connection)を専用のメソッドに切り出して、そちらを使用するよう修正しています。Base.connectionとBase.establish_connectionに依存しているのはshardingサポート対応で問題になっており、処理の修正を一箇所で済ませるようにする為に専用のメソッドに切り出したとの事です。
[Fix: #46455] ActiveRecord::Calculations#ids plucks included associations IDs
activerecord/lib/active_record/querying.rb、
activerecord/lib/active_record/relation/calculations.rbの修正です。
ActiveRecord::Calculations#idsを、associationではなくbase modelのunique idsを返すよう修正しています。元々は単にpluckを実行するだけの実装になっており、assocationをeager loadした場合にassociatinoのidも含むようになっていました。今回の修正で、associationのidは含まない、単純にbase modelのidを返すように変更になっています。
Post.find_by(id: 1).comments.count # => 5 Post.includes(:comments).where(id: 1).pluck(:id) # => [1, 1, 1, 1, 1] Post.includes(:comments).where(id: 1).ids # => [1]
Merge pull request #46661 from Shopify/clear-query-cache-deadlock
activerecord/lib/active_record/connection_adapters/abstract_adapter.rbの修正です。
Active Recordで使用する排他制御用のlock処理のインスタンスを、全てのconnectionで同じインスタンスを使用するよう修正しています。デッドロック回避の為。
Fix add_foreign_key with if_not_exists referencing the same table but via different columns
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbの修正です。
add_foreign_keyメソッドで、if_not_exists/if_existを指定、かつ、同メソッドでカラム名を複数している場合(e.g. add_foreign_key :friendships, :users, column: :friend_id, if_not_exists: true)に正しくカラムのチェック処理が行われないバグがあったのを修正しています。
AS::Cache#fetch fully skip the read operation when force: true
activesupport/lib/active_support/cache.rbの修正です。
ActiveSupport::Cache#fetchにforce: trueオプションを指定された場合、read処理を全て行わないよう修正しています。
Merge pull request #46271 from seanpdoyle/has-rich-text-strict-loading
actiontext/lib/action_text/attribute.rbの修正です。
has_rich_textメソッドにstrict_loadingオプションを指定出来るよう修正しています。
Focus editor after calling fill_in_rich_text_area
actiontext/lib/action_text/system_test_helper.rbの修正です。
fill_in_rich_text_areaメソッド実行時に、rich-text editorにフォーカスがあたるよう修正しています。実際にユーザがrich-text editorを操作した場合の挙動により近づける為。
#last and #first finders should use query_constraints for ordering
activerecord/lib/active_record/relation/finder_methods.rbの修正です。
query_constraints_listが指定されている場合、#first、#lastメソッドでorderする際にquery_constraints_listで指定されているカラムを使用するよう修正しています。
class Developer < ActiveRecord::Base query_constraints :company_id, :id end developer = Developer.first # => SELECT "developers".* FROM "developers" ORDER BY "developers"."company_id" ASC, "developers"."id" ASC LIMIT 1