なるようになるブログ

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

rails commit log流し読み(2022/11/18)

2022/11/18分のコミットです。

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

activesupport/CHANGELOG.md


Merge PR #45698

activesupport/lib/active_support/current_attributes.rbの修正です。

ActiveSupport::CurrentAttributes.resetsに実行する処理のメソッド名を指定出来るよう修正しています。

class Current < ActiveSupport::CurrentAttributes
  resets { Time.zone = nil }
  resets :clear_time_zone
end

Merge pull request #46505 from ytjmt/fix-testing-guide

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

Fixtures in Actionの項にある、PostgreSQLのpermissionsに関する記事のリンク先が404になっていたのを修正しています。

rails commit log流し読み(2022/11/17)

2022/11/17分のコミットです。

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

activerecord/CHANGELOG.md


Support optional collation in create_table output.

activerecord/test/cases/adapters/mysql2/table_options_test.rbの修正です。

create_tableの出力にcollationが含まれている場合もテストが通るよう修正しています。MariaDB 10.9.4でcollationが出力されるようになった為。


Merge pull request #46362 from nycdotnet/connection-pool-docs [ci-skip]

activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rbのdocの修正です。

connectionは何かSQLを実行するメソッドが呼ばれた場合に自動でconnection poolから取得される事、及び、with_connectionメソッドは、既に取得済みのconnectionを保持している場合poolからの取得処理は行われない、等の挙動の詳細についての説明を追加しています。


Merge pull request #46265 from bdewater/query-logs-docs [ci-skip]

activerecord/lib/active_record/query_logs.rbのdoc、及び、 rails guideのDebugging Rails Applicationsの修正です。

ActiveRecord::QueryLogsのdocにQuery Logsに関するconfigやSQLCommenterに関する説明を追加、及び、Debugging Rails Applications guideにSQLのコメントについて説明したSQL Query Commentsセクションを追加しています。


Use 2 spaces for identation in ActiveSupport code examples [ci-skip]

Active Supportのdocの修正です。

各doc内のコードexampleで、インデントにスペース2つを使うよう統一しています。


Use 2 spaces for identation in ActionView code examples [ci-skip]

Action Viewのdocの修正です。

各doc内のコードexampleで、インデントにスペース2つを使うよう統一しています。


Raise on assignment to readonly attributes

Active Recordの修正です。

readonly attributesに値を設定した場合、値の設定が出来てしまっていた(DBに保存はされない)のを、exceptionをraiseするよう修正しています。互換性の為、デフォルトは元の挙動のままになっており、config.active_record.raise_on_assign_to_attr_readonlyにtrueを指定した場合(load_defaults 7.1で指定される)のみexceptionをraiseするようになっています。

rails commit log流し読み(2022/11/16)

2022/11/16分のコミットです。

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


Merge pull request #46478 from jonathanhefner/app_generator_test-run_generator_and_bundler

railties/test/generators/app_generator_test.rbの修正です。

app generatorのテストで、Bunlderのstub処理をメソッドに切り出しています。


Fix typos [ci-skip]

docの修正です。

各docのタイポの修正を行っています。


Format inline code [ci-skip]

docの修正です。

doc内のメソッド名やファイル名などのフォーマットが正しく指定されてない箇所があったのを修正しています。


Auto-link code references [ci-skip]

docの修正です。

doc内で他のメソッドなどを言及している箇所で、そのメソッドのAPI docにリンクがされるよう修正しています。


Remove unnecessary link markup [ci-skip]

docの修正です。

doc内で他のメソッドなどを言及している箇所で、不要なリンクのマークアップの記述があったのを削除しています。


Document ActiveModel::Type::Time as time of day [ci-skip]

activemodel/lib/active_model/type/time.rbのdocの修正です。

ActiveModel::Type::Timeのdoc内のコードexampleを、ActiveModel::Type::Timeに渡された文字列はdateとtime zoneが自動でノーマライズされる(timeの値のみ指定された値が使用される)、という挙動ががわかるよう修正しています。


Replace ActionController::UrlFor references [ci-skip]

actionpack/lib/action_dispatch/routing/url_for.rbのdocの修正です。

現在は存在しないActionController::UrlForを参照している箇所があったのを、移行後のクラスであるActionDispatch::Routing::UrlForを参照するよう修正しています。


Tweak AD::Http::FilterParameters code example [ci-skip]

actionpack/lib/action_dispatch/http/filter_parameters.rbのdocの修正です。

ActionDispatch::Http::FilterParametersのdoc内の、挙動についての説明の言い回しの修を行っています。


Update ActionController::UrlFor request contract [ci-skip]

actionpack/lib/action_controller/metal/url_for.rbの修正です。

ActionController::UrlForのdoc内の、request変数の挙動について、現在と挙動と異なっている説明になっていたのを修正しています。


Clarify numeric casting behavior for blank strings [ci-skip]

Active Modelのdocの修正です。

numeric casting処理で、空文字が指定された場合の挙動についての説明を追加しています。


Elaborate doc for attribute read and write methods [ci-skip]

Active Recordのdocの修正です。

attributeのread、writeメソッドの挙動についての詳細な説明を追加しています。


Add *_check_constraint actions to Migrations guide [ci-skip]

rails guideのActive Record Migrationsの修正です。

Migrationメソッドの一覧に、check_constraint関連のメソッドを追加しています。


Use yaml code fence [ci-skip]

rails guideのThe Rails Command Lineの修正です。

yamlのexampleを記載している箇所のコードハイライトが正しく表示されるよう修正しています。


Fix link to "Conditional GET Support" section [ci-skip]

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

他guideへのリンク先の指定が誤っている箇所があったのを修正しています。


Add MDN links for security headers [ci-skip]

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

HTTPヘッダーについて説明している箇所に、MDNへのリンクを追加しています。


Fix Active Record Encryption credentials example [ci-skip]

rails guideのActive Record Encryptionの修正です。

Rotating Keysの項にあるyamlのexampleで、keyの指定が誤っていたのを修正しています。


Merge pull request #46485 from RubyElders/nodoc-all-arel-files

activerecord/lib/arel/filter_predications.rbactiverecord/lib/arel/nodes/filter.rbのdocの修正です。

private APIであるArelのfilter関係のclassがAPI docに表示されないよう修正しています。


Merge pull request #46484 from RubyElders/leading-join-node-namespace

Active Recordの修正です。

Arel::Nodes::LeadingJoinクラスがActiveRecord::QueryMethods module配下に定義されていたのを、Arel module配下で定義するよう修正しています。

rails commit log流し読み(2022/11/15)

2022/11/15分のコミットです。

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

activerecord/CHANGELOG.md


Merge pull request #46489 from OuYangJinTing/update-association-preload-doc [ci-skip]

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

preloadのドキュメントに、instance dependent associationsはpreload出来ない旨説明が記載されていたのを、preloadは可能である旨修正しています。Support preloads on instance dependent associationsでサポートされた為。


refactor ParameterEncodingTest and add test for param_encoding

actionpack/test/controller/parameter_encoding_test.rbの修正です。

ParameterEncodingTestについて、テスト名やアクション名を適切な名前に変更するなどのリファクタリング、及び、param_encodingを指定した場合のテストを追加しています。


Merge PR #45147

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

associationのpreload、及び、eager_loadをunscope出来るよう修正しています。


Merge pull request #45932 from marcoroth/migrate-guides-to-turbo

rails guideの修正です。

rails guideでページの表示にTurbolinksを使用していたのを、Turboを使用するよう修正しています。


Merge pull request #46410 from lazaronixon/fix-touch-has-one-parent

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

associationのtouch処理を伝搬する際に、親modelのhas_oneで定義されているassciationに対してもtouch処理が行われるよう修正しています。

rails commit log流し読み(2022/11/14)

2022/11/14分のコミットです。

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


Initialize encrypted attributes when using ActiveRecord::Relation#first_or_initialize/first_or_create

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

ActiveRecord::Relation#first_or_initialize、及び、#first_or_createメソッドで、encrypted attributesの初期化処理を行うよう修正しています。


Bump error_highlight 0.5.1 or higher

Gemfileの修正です。

error_highlight gemを0.5.1に更新しています。0.5.0であったエラーになってしまう問題が解決している為。


Enable Lint/DuplicateMagicComment cop

.rubocop.ymlの修正です。

Lint/DuplicateMagicComment copを追加しています。

rails commit log流し読み(2022/11/13)

2022/11/13分のコミットです。

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

activerecord/CHANGELOG.md


Update active_record_basics.md

rails guideのActive Record Basicsの修正です。

Delete処理について説明している箇所のグラマーの修正を行っています。


Replace hardcoded edge links in guides

rails guideの修正です。

API docへのリンク先がedgeapi.rubyonrails.orgになっている箇所があったのを、api.rubyonrails.orgに修正しています。


Add filtering of encrypted attributes in #inspect

activerecord/lib/active_record/encryption/configurable.rbactiverecord/lib/active_record/railtie.rbの修正です。

encrypted attributesを自動でfilter対象に追加するよう修正しています。inspectでencrypted attributesの値が表示されるのを避ける為。このfilter処理を無効化したい場合、config.active_record.encryption.add_to_filter_parametersにfalseを指定すればよいようになっています。