なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2023/03/22)

2023/03/22分のコミットです。

CHANGELOGへの追加はありませんでした。


Use explicit module for Rails::HealthController

railties/lib/rails/health_controller.rbの修正です。

HealthControllerのdocがAPI doc上でRails namespace配下に表示されるよう、moduleの指定を修正しています。


Fix #hash and #== for composite pk models

activerecord/lib/active_record/attribute_methods/primary_key.rbactiverecord/lib/active_record/core.rbの修正です。

composite primary keyを使用しているmodelのインスタンスで、primary keysに同じ値を使用している場合に同じオブジェクトと見なされるよう#hash#==を修正しています。

rails commit log流し読み(2023/03/21)

2023/03/21分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md


Do not allocate the first path character in asset helper

actionview/lib/action_view/helpers/asset_url_helper.rbの修正です。

asset_pathメソッドでオブジェクトの生成数を減らすようリファクタリングしています。


PostgreSQL adapter uses :host instead of :hostname for connection parameters

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rbの修正です。

PostgreSQL adapterで接続時のパラメータにhostnameを使用していたのをhostを使用するよう修正しています。hostnameは少なからず現在は指定出来るオプションではなく、hostが正しいパラメータ名な為。


Allow SQL Warnings to be ignored using error codes

activerecord/lib/active_record/connection_adapters/abstract_adapter.rbの修正です。

SQL warningをreportする機能で、ignoreするエラーをエラーコードで指定出来るよう修正しています。

# Configure allowlist of warnings that should always be ignored
config.active_record.db_warnings_ignore = [
  "1062", # MySQL Error 1062: Duplicate entry
]

Accept composite primary key in id=

activerecord/lib/active_record/attribute_methods/primary_key.rbの修正です。

id=メソッドにcomposite primary keyを指定出来るよう修正しています。


Fix nullification of has_many :through association with query_constraints

activerecord/lib/active_record/associations/through_association.rbactiverecord/lib/active_record/persistence.rbの修正です。

has_many :through + query_constraintsを使用しているassociationに対してのnullification([]を指定しての初期化)が動作するよう修正しています。

rails commit log流し読み(2023/03/20)

2023/03/20分のコミットです。

CHANGELOGへの追加はありませんでした。


[skip-ci] adding missing config generator line to prevent creating stylesheets inside generators.rb (section: Customizing Your Workflow)

rails guideのCreating and Customizing Rails Generators & Templatesの修正です。

Customizing Your Workflowの項にある、stylesheetsとfixtureを生成しない場合の例で、stylesheetsを生成しないようにする指定が不足していたのを修正しています。

rails commit log流し読み(2023/03/18)

2023/03/18分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md


Run a load hook when TestFixtures is included

activerecord/lib/active_record/test_fixtures.rbの修正です。

ActiveRecord::TestFixturesがincludeされた際に実行する:active_record_fixtures hookを追加しています。TestFixturesがincludeされた際にfixture_pathsにpathを追加する場合などに使う事を想定しているとの事です。

ActiveSupport.on_load(:active_record_fixtures) do
  self.fixture_paths << "test/fixtures"
end

Correct typos in activerecord changelog and querylogs docs [ci-skip]

activerecord/CHANGELOG.mdactiverecord/lib/active_record/query_logs.rbのdocの修正です。

initializerinializerにタイポしていたのを修正しています。

rails commit log流し読み(2023/03/17)

2023/03/17分のコミットです。

CHANGELOGへの追加はありませんでした。


Allow querying by whole record for composite query constraints associations

activerecord/lib/active_record/relation/predicate_builder/association_query_value.rbの修正です。

composite query constraintsを使用しているassociationをqueryのconditionに指定出来るよう修正しています。


Rename classes to the filename

railtiesのテストの修正です。

各コマンドのテストのテストクラス名がファイル名と一致するよう修正しています。


Fix rails-ujs tests not being linted

rails-ujsのテストの修正です。

rails-ujsのテストファイルに対してlintが実行されなくなっていたのを、再度実行されるよう修正しています。

rails commit log流し読み(2023/03/16)

2023/03/16分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #47683 from yskkin/patch-3

activerecord/lib/active_record/attribute_assignment.rbの修正です。

使用していないrequireを削除しています。


Rely on AM::ForbiddenAttributesProtection autoload

activerecord/lib/active_record/relation/query_methods.rbの修正です。

autoloadの対象となっており不要なrequireを削除しています。


Add example of simple environment config extending

rails guideのConfiguring Rails Applicationsの修正です。

Creating Rails Environmentsの項に、既存のenvironmentsを使用して新しいenvironmentsを追加する場合(e.g. production.rbを拡張してstaging.rbを作成する)の例を追加しています。


Undefine with on NilClass and other common immediate types

activesupport/lib/active_support/core_ext/object/with.rbの修正です。

NilClassTrueClassなどのimmediate typesにはwithメソッドを定義しないよう修正しています。それらのクラスではwithメソッドは不要で、逆にメソッドが定義されている事で予期せぬ挙動の原因になってしまう可能性がある為。


Also undefine with on Symbol

activesupport/lib/active_support/core_ext/object/with.rbの修正です。

Symbolにもwithメソッドを定義しないよう修正しています。