2023/11/04分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activemodel/CHANGELOG.md
Fix method visibility in ActiveRecord::Attributes
activerecord/lib/active_record/attributes.rbの修正です。
ActiveRecord::Attributes#reload_schema_from_cache、及び、#reset_default_attributesメソッドの可視性を、それぞれActiveRecord::ModelSchema#reload_schema_from_cache及びActiveModel::AttributeRegistration#reset_default_attributesと同じになるよう修正しています。
Remove config.public_file_server.enabled from generators
railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.ttの修正です。
rails newで生成されるconfig/environments/test.rbからconfig.public_file_server.enabledの設定を削除しています。デフォルト値と同じ値が設定されており、設定が不要な為。
Port type_for_attribute to Active Model
Active Model、Active Recordの修正です。
Active Recordで定義されていたtype_for_attributeメソッドをActive Modelに移動しています。これにより、ActiveModel::Attributesをincludeするだけでtype_for_attributeメソッドが使えるようになっています。
class MyModel include ActiveModel::Attributes attribute :my_attribute, :integer end MyModel.type_for_attribute(:my_attribute) # => #<ActiveModel::Type::Integer ...>
Port BeforeTypeCast to Active Model
Active Model、Active Recordの修正です。
Active Recordで定義されていたBeforeTypeCastmoduleをActive Modelに移動しています。これにより、ActiveModel::Attributesをincludeするだけで*_before_type_cast、*_for_database等のメソッドが使えるようになっています。
class MyModel include ActiveModel::Attributes attribute :my_attribute, :integer end m = MyModel.new m.my_attribute = "123" m.my_attribute # => 123 m.my_attribute_before_type_cast # => "123" m.read_attribute_before_type_cast(:my_attribute) # => "123"
Autolink AR::ConnectionAdapters::NullColumn [ci-skip]
activerecord/lib/active_record/model_schema.rbのdocの修正です。
column_for_attributeメソッドのdoc内のActiveRecord::ConnectionAdapters::NullColumnが該当のclassのdocへのリンクになるよう修正しています。
Specialize various #present? implementations
Active Supportの修正です。
DateTimeやFalseClassなど、Active Supportで拡張している幾つかのcore classに#present?メソッドを実装するよう修正しています。元々はObject#present?が使用されるようになっていたのですが、このメソッドはキャッシュヒット率が高くない、かつ、幾つかのクラスでは不要なblank?メソッドの呼び出しが必ず発生してしまっていました。そのため、高速化の為に#present?メソッドを直接実装するよう修正しています。
Merge pull request #49907 from p8/guides/association-callbacks
rails guideのActive Record Callbacks、Active Record Associationsの修正です。
Active Record Associations guideにあったcallback関係の説明をActive Record Callbacks guideに移動しています。
Avoid recalculating CounterCache.counter_cached_association_names
activerecord/lib/active_record/counter_cache.rbの修正です。
CounterCacheでschemaをloadする際、Prebuild list of counter cache associationsで対応したcache済みの値を使用するよう修正しています。