なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md


Merge pull request #35121 from utilum/warning_tried_to_create_proc_without_block

blockを明示的に指定せずにProcを生成している箇所(メソッドの引数のブロックが使用されていた箇所)があったのを修正しています。

Ruby 2.6までは、blockを指定せずにProcを生成する事が出来、その場合、メソッドへ渡されたブロックがそのまま使用されていました。ただ、この挙動がRuby 2.7からwarningが出るようになった為、メソッドの引数にblockが来ることを期待している箇所は、メソッドの引数にblock用の変数を追加するよう修正しています。

参考: ruby-trunk-changes r66760 - r66776


Merge pull request #35449 from pjrebsch/quoting-empty-range

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

空の配列に関するquote処理が正しく行われていないバグがあったのを修正しています。

# before
User.where('id = ?', 0...0).to_sql
#=> "SELECT \"users\".* FROM \"users\" WHERE (id = )"

# after
User.where('id = ?', 0...0).to_sql
#=> "SELECT \"users\".* FROM \"users\" WHERE (id = NULL)"

Fix query attribute method on user-defined attribute to be aware of typecasted value

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

ユーザが定義したattributeに対してquery attribute methodを実行した際に、type castした値が使用されないバグがあったのを修正しています。


Fix random CI failure due to non-deterministic sorting order

activerecord/test/cases/finder_test.rbの修正です。

find_byのテストで使用するmodelを変更しています。元のmodelだとデータが複数あり、取得されるデータが非決定的でランダムでテストが失敗してしまう事がある為。


Add example of the output of rails routes --expanded in the routing guide [ci skip]

rails guideのRails Routing from the Outside Inの修正です。

Listing Existing Routesの項に、rails routes--expandedを指定した場合のexampleを追加しています。


Remove MigrationTest#test_create_table_with_custom_sequence_name

activerecord/test/cases/migration_test.rbの修正です。

Oracle enhanced adapterの場合のみ実行していたテストを削除しています。Oracle enhanced adapter側で該当のテストを実行するようにする為との事です。


Merge pull request #35525 from audiolion/feature/dynamic-actioncable-websocket-url

actioncable/app/javascript/action_cable/index.jsの修正です。

Action CableのWebSocket URLにfunctionを指定出来るようにしています。authorization tokenを指定する場合等、動的にURLを生成したいケースがある為。


Use the -u switch for the rails server banner

railties/lib/rails/commands/server/server_command.rbの修正です。

rails serverコマンドのヘルプに、deprecatedになったオプションの指定方法が表示されていたのを修正しています。


Mention environment variable instead of just environment

railties/CHANGELOG.mdrailties/lib/rails/commands/server/server_command.rbの修正です。

CHANGELOG、deprecatedメッセージ内のenvironmentenvironment variableに修正しています。


Fix style issues and build source after #35525

actioncable/app/assets/javascripts/action_cable.jsactioncable/app/javascript/action_cable/index.jsの修正です。

先のWebSocket URLにfunctionを指定出来るようにした対応で、ソースのbuild処理が不足していたのを対応、及び、lintに違反しているコードがあったのを修正しています。


Squish the deprecation messages across the codebase

各箇所のdeprecatedメッセージを表示する際に、不要な空白が表示されないよう修正しています。


[ci skip] Removed extra hyphens

rails guideのRails Routing from the Outside Inの修正です。

rails routes--expandedを指定した場合のexampleから、不要なハイフンを削除しています。