なるようになるブログ

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

rails commit log流し読み(2024/04/10)

2024/04/10分のコミットです。

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

activesupport/CHANGELOG.md


Remove example filepaths from code blocks in guides

guides/rails_guides/markdown/renderer.rbの修正です。

code blockからcodeが記載されているファイルパスを削除しています。codeをコピーする際に不要な情報であるファイルパスが含まれないようにする為。


Add more ostruct requires

ostructのrequireが足りてないと思われている箇所にrequireを追加しています。


Add missing ostruct require on AR test suite

ostructのrequireが足りてないと思われている箇所にrequireを追加しています。


Remove usage of OpenStruct

OpenStructを使用している箇所をStructを使用するよう修正しています。


Fix fourth column issue in guides dropdown

guides/assets/stylesrc/_main.scssの修正です。

guideのdropdownで4列目が正しく表示されてなかったのを修正しています。


Fix ActiveJob::EnqueueAfterTransactionCommit API

Active Job、Active Supportの修正です。

Active Recordのtransaction内でActive Jobのenqueueが行われた場合に、自動でtransaction commit後にjobのenqueueを行うよう修正した、Automatically delay Active Job enqueues to after commitの対応の影響で、perform_laterの戻り値が変わってしまっていたのを、極力元と同じ値(成功時はjobのinstance、失敗時はfalse)を返すよう修正しています。

合わせて、この対応のテストの為に、stub_constメソッドにstub対象のconstantが存在しない場合に、エラーをraiseしないよう指定する為のexists: false引数を追加しています。


Merge pull request #51536 from jathayde/scrollbar-color-fix

guides/assets/stylesrc/_main.scssの修正です。

rails guideで、Safari/Webkitを使用していた場合のscrollbarのbackground colorがredになってしまっていたのを修正しています。


form_helper documentation using article instead of post

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

exampleコードで使用するmodel名をPostからArtcleに変更しています。Postだとmethod名もpostで紛らわしい為。

rails commit log流し読み(2024/04/09)

2024/04/09分のコミットです。

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


Minor tweaks / improvements to recent changelog/api docs [ci skip]

docの修正です。

各docのグラマーや用語の修正を行っています。


Fix textdecorator specificity on hovering in index

guides/assets/stylesrc/_main.scssの修正です。

rails guideのindexページで、hover時のtext-decoratorとcolorを正しく使用されてなかったのを修正しています。


Raise when both :force and :if_not_exists provided to create_table

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

create_table:force:if_not_existsオプションを同時に指定した場合に、ArgumentErrorをraiseするよう修正しています。


[RF-DOCS] Action View Helpers Documentation [ci-skip] (#51432)

rails guideのAction View Helpersの修正です。

guide全体について、セクションの見直し、exampleやメソッドの追加、言い回しの修正等を行っています。


Remove duplicated features attribute on devcontainer.json.tt

railties/lib/rails/generators/rails/app/templates/.devcontainer/devcontainer.json.ttの修正です。

重複していたfeatures attributeの指定を削除しています。


Fix minor typos in enqueue_after_transaction_commit default docs

railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.ttのdocの修正です。

コメント内のタイポを修正しています。


Properly escape paths in erb example code blocks in guides [ci-skip]

rails guideのThe Asset Pipelineの修正です。

exampleコード内のコメント部分を適切にエスケープするよう修正しています。


Use SQL comments for SQL code blocks in guides [ci-skip]

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

SQL code block内のコメントにSQLのcomment指定(--)を使用するよう修正しています。


Merge pull request #51355 from asavageiv/alan/update-docs

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

Creating Namespaced Modelsセクションのexampleコードで、他のセクションと同じmodel名を使用するよう修正しています。


Ensure association's foreign_key: and query_constraints: options behave the same

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

associationのforeign_keyオプションがArrayの場合、query_constraintsに同じ値を設定するよう修正しています。composite foreign keyを使用している場合に自動のinverse処理が正しく動作するようにする為。

rails commit log流し読み(2024/04/08)

2024/04/08分のコミットです。

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


Improve ActionCable redis config example [skip ci]

rails guideのAction Cable Overviewの修正です。

redis用のconfigのexampleから、不要な{}を削除しています。


Fix a typo in activerecord/CHANGELOG.md

activerecord/CHANGELOG.mdの修正です。

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


Fix small typo's in ActiveRecord Changelog [ci-skip]

activerecord/CHANGELOG.mdの修正です。

各エントリーのタイポの修正、及び、フォーマットの修正を行っています。


Update default value for content_types_allowed_inline in guides

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

config.active_storage.content_types_allowed_inlineのデフォルト値を最新の内容に更新しています。

rails commit log流し読み(2024/04/06)

2024/04/06分のコミットです。

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

actioncable/CHANGELOG.md


Record ping on every actioncable message

Action Cableの修正です。

pingwelcome message typeでしかconnectionを維持するようになってなかったのを、全てのAction Cableのmessageで受信した際にconnectionがactiveである旨判断するよう修正しています。


Update enqueue_after_transaction_commit changelog [ci-skip]

activejob/CHANGELOG.mdの修正です。

enqueue_after_transaction_commitに指定出来る値を正しい内容に更新しています。


Merge pull request #51497 from bensheldon/preparable-in

activerecord/lib/arel/visitors/to_sql.rbの修正です。

INにsubselectで取得した値を指定する場合に、Prepared Statementsを使用出来る場合はPrepared Statementsを使用するよう修正しています。


Update active_record_querying.md

rails guideのActive Record Query Interfaceの修正です。

各箇所のグラマーやフォーマットの修正を行っています。


Merge pull request #51498 from Uaitt/fields_for_documentation_improvements

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

fields_forメソッドのdoc内の言い回しを修正しています。


Counter cache columns are not marked as readonly [skip ci]

activerecord/lib/active_record/associations.rbのdoc、及び、rails guideのActive Record Associationsの修正です。

counter cacheで使用されるcolumnはreadonlyが設定される旨記載があったのを削除しています。現在はreadonlyが設定されるようにはなっていない為。

rails commit log流し読み(2024/04/05)

2024/04/05分のコミットです。

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

activerecord/CHANGELOG.md


Merge pull request #51478 from kmcphillips/mysql-parse-version-error

activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rbactiverecord/lib/active_record/errors.rbの修正です。

MySQL databaseが不正なversion stringを返した場合に、ActiveRecord::ActiveRecordErrorをraiseするよう修正しています。DBへの接続にproxyを使用している場合に、proxyが誤った値を返すことがあるらしく、そのような場合に気づけるようにする為。


Add queries count to template rendering instrumentation

activerecord/lib/active_record/railties/controller_runtime.rbactiverecord/lib/active_record/runtime_registry.rbの修正です。

template rendering instrumentationにquery countを含むよう修正しています。

# Before
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms | Allocations: 112788)

# After
Completed 200 OK in 3804ms (Views: 41.0ms | ActiveRecord: 33.5ms (2 queries, 1 cached) | Allocations: 112788)

rails commit log流し読み(2024/04/04)

2024/04/04分のコミットです。

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

railties/CHANGELOG.md


Merge pull request #51449 from p8/guides/remove-proxy-association

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

private APIであるproxy_association accessorについての説明を削除しています。


Allow Actionable Errors encountered when running tests to be retried.

railtiesの修正です。

pendingになっているmigrationがある、などのActionable Errorがテスト実行時に発生した場合に、そのエラーの解消をターミナルから指定&テストの再実行を行えるよう対応しています。


Fix documentation for enqueue_after_transaction_commit

railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.ttのdoc、及び、rails guideのConfiguring Rails Applicationsの修正です。

enqueue_after_transaction_commitについてのdocのグラマーやフォーマットの修正を行っています。


Add missing ostruct require to http_token_authentication_test.rb

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

不足していたostructのrequireを追加しています。


Arel: make Or nodes "Nary" like And

Active Recordの修正です。

大量のOr条件が指定された場合に、Active Record preloaderでのload処理でSystemStackErrorが発生してしまうバグがあったのを修正しています。Arelのtreeのdepthが深くなりすぎてしまっていたのが問題だった為、Arelのtreeのdepthの管理を変えるよう修正しています。


Stop generating files with git_source(:github)

rails newで生成するGemfileや、bug report templatesからgit_source(:github)の指定を削除しています。Bundlder本体で同等のメソッドを保持しており、Rails側で独自に定義する理由が今は無い為。


Merge pull request #51480 from albus522/dg/improve-vips-analyzer

activestorage/lib/active_storage/analyzer/image_analyzer/vips.rbの修正です。

ruby-vipsでimageのanalyzingを行う際に、Vips::Image#avgメソッドを使用して対象のファイルが画像かどうかをチェックしていたのをしないよう修正しています。Vips::Image#avgはファイルをまるごと読み込むのでメモリを大量に使用する、かつ、画像では無い場合は違う処理でエラーになるので、ここでのチェックが無くても問題無い為。