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で定義されていたBeforeTypeCast
moduleを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済みの値を使用するよう修正しています。