なるようになるブログ

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

rails commit log流し読み(2019/07/15)

2019/07/15分のコミットです。

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


Use reserved domain for example configuration

Action Packの修正です。

HTTP Feature Policyのexampleに実際に存在するドメインが使用されていたのを、example.comを使用するよう修正しています。


Merge pull request #36663 from igor04/load_database_yaml_fix

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

config/database.ymlの中身が空だった場合にロード時にNoMethodErrorが発生してしまうバグがあったのを修正しています。


Delete mention of Ruby 1.9 [skip ci]

rails guideのActive Support Core Extensionsの修正です。

Wrappingの項にRuby 1.8、1.9での処理ついて言及している箇所があったのを削除しています。現状サポートしているのは2.5以上であり、内容が古いすぎる為。

rails commit log流し読み(2019/07/14)

2019/07/14分のコミットです。

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


Remove obsolete or discouraged render examples

rails guideのLayouts and Rendering in Railsの修正です。

Wrapping it upの項から、現在は推奨されていないrenderの使い方をしているexampleを削除しています。


Update guide for render file:

rails guideのLayouts and Rendering in Railsの修正です。

fileオプションの使い方について説明していたRendering an Arbitrary Fileの項を削除しています。現在出来ないアプリの外側にあるファイルの参照方法についての説明になっていた為。

代わりにRendering raw file項を追加し、そちらでfileオプションを使用してテンプレートでないファイルを参照する方法について説明するようにしています。


Merge pull request #36658 from Shopify/duplicable-changes

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

Ruby 2.5以上だとdup出来るクラスのduplicable?メソッドを定義する為の処理を削除しています。合わせて、UnboundMethod#duplicable?メソッドを追加しています。


Fix activestorage CI failure due to ffprove version differece

activestorage/test/analyzer/video_analyzer_test.rbの修正です。

rotated videoに対するanalyzeのテストからdurationのチェックを削除しています。

CIで使用するOSが変わった事によりffproveのバージョンがあがりテストがコケるようになってしまった、かつ、rotated videoに対するテストはangleが正しく取得出来ている事の確認がメインで、durationのチェックは重要ではない為。

rails commit log流し読み(2019/07/13)

2019/07/13分のコミットです。

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


make sure zeitwerk:check only deals with directories [closes #36461]

railties/lib/rails/tasks/zeitwerk.rakeの修正です。

zeitwerk:check taskでディレクトリだけチェックするよう修正しています。

eager loadの対象にファイルが含まれている事がある(Action Cableがそういう使い方をしている)為。


ports edits to the upgrading guide [skip ci]

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

Autoloadingの項に、zeitwerk:checkのチェックに成功しても正しくロードされないケースがまれにある為、development envでeager_loadを有効化 + アプリケーションロードを実行する事を推奨する旨説明を追加しています。


improves zeitwerk:check

railties/lib/rails/tasks/zeitwerk.rakeの修正です。

zeitwerk:check taskでeager_load_allを行うようリファクタリングを行っています。


simplifies Zeitwerk compat instructions in upgrading guide [skip ci]

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

先ほどdevelopment envでeager_loadを有効化する旨説明を追加したのですが、zeitwerk:checkeager_load_allを行う事によりこれらの対応は不要になった為、それら不要になった説明を削除しています。


let the upgrading guide point to the autoloading guide for STIs [skip ci]

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

STIを使用している場合の説明を削除し、代わりに、Autoloading and Reloading Constants (Zeitwerk Mode)へのリンクを追加するよう修正しています。

rails commit log流し読み(2019/07/12)

2019/07/12分のコミットです。

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


Improve changelog entry, remove extraneous word [ci skip]

activesupport/CHANGELOG.mdの修正です。

CHANGELOGエントリーのグラマーの修正を行っています。


completes first version of the new autoloading guide [skip ci]

rails guideのAutoloading and Reloading Constants (Zeitwerk Mode)の修正です。

zeitwerkが想定しているアプリの構成について説明したProject Structureの項を追加、及び各項の言い回しの修正等を行っています。


minor edit [skip ci]

guides/source/documents.yamlの修正です。

Autoloading and Reloading Constants (Classic Mode)の説明のグラマーの修正を行っています。


These are already required via rails/command.rb

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

active_supportactive_support/core_ext/object/blankのrequireを削除しています。直前でrequireしているrails/commandでrequireされている為。


Make sure to require active_support.rb before requiring active_support/rails.rb

actionpack/lib/abstract_controller.rbの修正です。

active_support/railsをrequireする前にactive_supportをrequireするよう修正しています。


active_support/dependencies/autoload is already required via active_support.rb

各ファイルからactive_support/dependencies/autoloadのrequireを削除しています。active_supportでrequireされる為。


try (Just a Little Bit Harder)

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

tryメソッドを使用していた箇所をsafe navigation operatorを使用するよう修正しています。


No Woman, No try

各ファイルから使用していないactive_support/core_ext/object/tryのrequireを削除しています。


A type class or nil has to respond_to :to_s

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

tryメソッドを使用していた箇所をsafe navigation operatorを使用するよう修正しています。


active_support/rails has to be required via abstract_controller.rb

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

active_support/railsのrequireを削除しています。直後にrequireしているabstract_controllerでrequireされている為。


active_support/deprecation is not in use here

activesupport/lib/active_support/callbacks.rbactivesupport/lib/active_support/inflector/inflections.rbの修正です。

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


active_support/deprecation has to be already required via active_support/rails.rb

各ファイルからactive_support/deprecationのrequireを削除しています。active_support/railsでrequireされる為。


try (Just a Little Bit Harder)

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

tryメソッドを使用していた箇所をsafe navigation operatorを使用するよう修正しています。


No Woman, No try

各ファイルから使用していないactive_support/core_ext/object/tryのrequireを削除しています。


A type class or nil has to respond_to :to_s

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

tryメソッドを使用していた箇所をsafe navigation operatorを使用するよう修正しています。


active_support/rails has to be required via abstract_controller.rb

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

active_support/railsのrequireを削除しています。直後にrequireしているabstract_controllerでrequireされている為。


active_support/deprecation is not in use here

activesupport/lib/active_support/callbacks.rbactivesupport/lib/active_support/inflector/inflections.rbの修正です。

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


active_support/deprecation has to be already required via active_support/rails.rb

rails commit log流し読み(2019/07/11)

2019/07/11分のコミットです。

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

actionpack/CHANGELOG.md


Merge pull request #36618 from engwan/fix-query-cache-with-shared-ar-connection

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

shared connectionsを有効化している場合に、query cacheのメソッドで参照するスレッドに誤りがあったのを修正しています。


Merge pull request #36637 from Shopify/share-quote-cache

Active Recordの修正です。

AbstractAdapterクラスのインスタンス変数で保持していたカラム名とテーブル名のキャッシュをクラス変数で保持するよう修正しています。コネクション間でキャッシュを使いまわせるようにする為。


Merge pull request #36645 from Shopify/arel-dispatch-cache

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

Arelのdispatchキャッシュをコネクション間で使いまわせるよう修正しています。


MySQL: Check error number instead of a message

activerecord/lib/active_record/connection_adapters/mysql2_adapter.rbactiverecord/lib/active_record/tasks/mysql_database_tasks.rbの修正です。

MySQL adapterでDBが作成済み / 未作成かを判定するのにエラーメッセージの内容をチェックしていたのを、error numberをチェックするよう修正しています。ロケールに依存せずチェック出来るようにする為。


Adds support for configuring HTTP Feature Policy (#33439)

Action Pack、railtiesの修正です。

Feature Policy headerを設定出来るよう対応しています。

設定はアプリ全体(initializersで実施)、及び、controller単位で出来るようになっています。

# config/initializers/feature_policy.rb
Rails.application.config.feature_policy do |f|
  f.camera      :none
  f.gyroscope   :none
  f.microphone  :none
  f.usb         :none
  f.fullscreen  :self
  f.payment     :self, "https://secure-example.com"
end
class PostsController < ApplicationController
  feature_policy do |f|
    f.geolocation "https://example.com"
  end
end

参考: Introduction to Feature Policy  |  Web  |  Google Developers


Merge pull request #36647 from giraffate/fix_exists_with_distinct_and_offset_and_order_in_postgresql

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

joinしたtableに対するorder + distinct + offset + relation.exists?を使用した場合にPostgresSQLで不正なSQLが生成されてしまうバグがあったのを修正しています。


Do not use hard tabs in CHANGELOGs [ci skip]

activesupport/CHANGELOG.mdの修正です。

CHANGELOGでハードタブを使っている箇所があったのをスペースに修正しています。ハードタブだとインデントとして正しく認識されない為。

rails commit log流し読み(2019/07/10)

2019/07/10分のコミットです。

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


autoloading guide revamped for Zeitwerk mode [skip ci]

Autoloading and Reloading Constants guideを、Zeitwerkを使用した場合での説明に修正しています。

元の内容(classic modeを使用した場合)はAutoloading and Reloading Constants (Classic Mode) guideという別のguideとして残すように次のコミットで対応しています。


renames and revises the autoloading guide for classic mode [skip ci]

classic modeを使用している場合のautoload / reloadの処理について説明したAutoloading and Reloading Constants (Classic Mode) guideを追加しています。


updates the guides table of contents [skip ci]

guides/source/documents.yamlの修正です。

先ほど追加したclassic modeの場合のguideをguideの一覧に追加しています。


fixes link [skip ci]

Autoloading and Reloading Constants guideの修正です。

Autoloading and Reloading Constants (Classic Mode)へのリンクのフォーマットに誤りがあったのを修正しています。


fixes link [skip ci]

rails guideのAutoloading and Reloading Constants (Classic Mode)の修正です。

Autoloading and Reloading Constants (Zeitwerk Mode)へのリンクのフォーマットに誤りがあったのを修正しています。

rails commit log流し読み(2019/07/09)

2019/07/09分のコミットです。

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

activerecord/CHANGELOG.md


Merge pull request #36471 from itsWill/add_database_exist_method

Active Recordの修正です。

データベースが存在するかどうかをチェックする為のdatabase_exists?メソッドを追加しています。


update example url for add_source

rails guideのRails Application Templatesの修正です。

add_sourceメソッドのexampleでcode.whytheluckystiff.netを指定していたのを、gems.github.comに修正しています。code.whytheluckystiff.netはスパムサイトになってしまっている為。


Fix indentation 💇‍♀️

activerecord/CHANGELOG.mdの修正です。

対応者部分のインデントを調整しています。


Merge pull request #36612 from y-yagi/make_setup_works_when_using_with_locales_other_than_en

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

postgresql_connectionメソッドでデータベースが存在しない事によるエラーかどうかを判断するのに、メッセージにdoes not existが含まれているかをチェックしていたのを、メッセージにデータベース名が含まれているかどうかでチェックするよう修正しています。

PostgreSQLのメッセージはロケールに合わせて翻訳されたメッセージになっており、does not existだと英語以外のロケールの場合に正しくチェック出来ない為。