2023/09/01分のコミットです。
CHANGELOGへの追加はありませんでした。
Allow Active Record to derive the association query constraints
activerecord/lib/active_record/autosave_association.rb
、
activerecord/lib/active_record/reflection.rb
の修正です。
modelにquery constraintsが定義されている場合に、自動的にassociationに対するquery constraintsも定義するよう修正しています。例えば、modelとそのmodelのassociation両方に対してquery constraintsを定義したい場合、元々は下記のようにそれぞれ定義する必要がありました。
class Post query_constraints :blog_id, :id has_many :comments, query_constraints: [:blog_id, :blog_post_id] end class Comment query_constraints :blog_id, :id belongs_to :blog, query_constraints: [:blog_id, :blog_post_id] end
この対応により、下記のようにassociationに対するquery constraintsは省略出来るようになっています(Active Recordが自動で推測する)。
class Post query_constraints :blog_id, :id has_many :comments end class Comment query_constraints :blog_id, :id belongs_to :blog end
なお、この自動での設定は、query constraintsが複数定義されている場合や、query constraintsにprimary keyが含まれていないよような場合は動作しない、というような制限があります。
Added the missing codeblock highlights in guides
rails guideの修正です。
codeblockでlangの指定がされてなかった箇所にlangの指定を追加しています。
Merge pull request #49093 from akhilgkrishnan/actiontext-notable-release-note
rails guideのRuby on Rails 7.1 Release Notes
の修正です
Action TextのNotable changesについての説明を追加しています。
Merge pull request #49094 from akhilgkrishnan/activejob-notable-release-note
rails guideのRuby on Rails 7.1 Release Notes
の修正です
Active JobのNotable changesについての説明を追加しています。
Fix alias_attribute deprecation warning and message
Active Recordの修正です。
Active Recordのテスト実行時にalias_attribute
に関するdeprecateメッセージが出力されていたのを、テストを修正して対応、及び、メッセージのフォーマットが崩れていたのを修正しています。
activerecord/lib/active_record/table_metadata.rb
の修正です。
polymorphicを使用しているhas_many relationをSTIのmodelで使用している場合に、STIに対するrelationにclass_name
オプションの指定が無いとエラーになってしまうバグがあったのを修正しています。
[skip ci] Description added for Allow templates to set strict locals in 7.1 release note
rails guideのRuby on Rails 7.1 Release Notes
の修正です
templateで受け付けるlocals
変数を定義出来るよう対応した、Allow templates to define which locals they acceptについての詳細な説明を追加しています。
Remove useless include in DescendantsTracker
activesupport/lib/active_support/descendants_tracker.rb
の修正です。
DescendantsTracker
のincludeを削除しています。新しいRubyではDescendantsTracker#subclass
が定義されていないからfilterは不要で、古いRubyではDescendantsTracker.subclass
でfilter処理が行われておりどちらにしろ不要な為。
Fix ActiveRecord.disconnect_all!
to not disable reconnect on pools
activerecord/lib/active_record/connection_adapters/pool_config.rb
の修正です。
ActiveRecord.disconnect_all!
メソッドでpool内での再接続を無効にしていたのを、有効にするよう修正しています。