なるようになるブログ

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

rails commit log流し読み(2019/08/05)

2019/08/05分のコミットです。

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

activesupport/CHANGELOG.md

actionview/CHANGELOG.md


Merge pull request #36845 from eileencodes/fix-pg-closed-connection

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

fixtureの作成処理の最初にconnectionを接続していたのを、実際にconnectionが必要になった際に接続するよう修正しています。

複数DBを使用している場合に、modelでの接続処理より先にconnectionへの接続を行ってしまうと、誤ったキャッシュが作成されてしまい、結果実際に使用する際にエラーになってしまうケースがあった為、との事です。


Mention how to use webpacker in updated Rails apps [ci skip]

rails guideのUpgrading Ruby on Railsの修正です。

Upgrading from Rails 5.2 to Rails 6.0にWebpackerを使う方法の説明を追加しています。


Able to initalize default value for thread_mattr_*

activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rbの修正です。

thread_mattr_*メソッドにdefaultを指定する為のオプションを追加しています。

class Scraper
  thread_mattr_reader :client, default: Api::Client.new
end

Use Thread.pass instead of Kernel.sleep to trigger race condition

activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rbactivesupport/test/core_ext/module/attribute_accessor_per_thread_test.rbの修正です。

先ほど追加されたthread_mattr_*メソッドのdefaultを指定する際にblockを使用して値を指定出来るようになっていたのですが、このサポートを削除、及び、thread_mattr_*メソッドのテストでスレッドが競合状態になるよう修正しています。


handle passing in primary key to unique_by, and handle primary keys missing indexes

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

upsertメソッドのunique_byオプションにprimary keyを指定した場合にエラーになってしまうバグがあったのを修正しています。


Update sanitizer in ActionView::Helpers::SanitizeHelper

actionview/lib/action_view/helpers/sanitize_helper.rbactiontext/app/helpers/action_text/content_helper.rbの修正です。

rails-html-sanitizer 1.1.0向けの対応を行っています。white_list_sanitizerがdeprecateになり、safe_list_sanitizerを使う事が推奨されるようになったので、それに合わせてメソッドの置き換えを行っています。

参考: rails/rails-html-sanitizer/CHANGELOG.md#110


Use newly released rails-html-sanitizer

Gemfile.lockの修正です。

rails-html-sanitizerのバージョンを1.1.0に更新しています。


Merge pull request #36537 from quadule/fix-cookie-rotation-hash-pollution

actionpack/lib/action_dispatch/middleware/cookies.rbの修正です。

cookieのrotation処理で不要な値が含まれてしまうバグがあったのを修正しています。


Remove unused require

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

使用していないactive_support/deprecationのrequireを削除しています。


Corrected deperecation config option path for active_record.sqlite3.represent_boolean_as_integer option in release notes. [ci skip]

rails guideのRuby on Rails 6.0 Release Notesの修正です。

`config.active_record.sqlite3.represent_boolean_as_integerconfig.activerecord.sqlite3.represent_boolean_as_integerにタイポしていたのを修正しています。


Merge pull request #36823 from abhaynikam/add-multiple-database-guide-entry-to-release-notes

rails guideのRuby on Rails 6.0 Release Notesの修正です。

Ruby on Rails GuidesNotable changesの項に、複数DBのガイドを追加した対応についてのエントリーを追加しています。