なるようになるブログ

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

rails commit log流し読み(2019/01/17)

2019/01/17分のコミットです。

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

railties/CHANGELOG.md


Remove frozen_string_literal from Action Cable's template files

actioncable/lib/rails/generators/test_unit/templates/channel_test.rb.ttrails/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.ttの修正です。

Action Cableのtemplateファイルからfrozen_string_literalを削除しています。他のtemplateと合わせる為。


Fix document formatting on ActionMailbox [ci skip]

Action Mailboxのdocの修正です。

doc全体のフォーマットの修正を行っています。


Revert "Don't handle params option in a special way in url_for helper"

url_forメソッドからparamsオプションについての処理を削除した、Merge pull request #33256 from ilkkao/ilkkao/remove-unused-params-optionをrevertしています。

:domainのような特定のオプションを渡す為に必要な為、との事です。例えば、url_for(domain: 'foo.com') だとfoo.comが生成されるのですが、url_for(params: { domain: 'foo.com' })だと?domain=foo.comとなる、という使い分けがある為。


Add rails test:channels.

railties/lib/rails/test_unit/testing.rakeの修正です。

channelのテストを実行する為のtest:channels taskを追加しています。


Require hash/keys inside active_model/callbacks

activemodel/lib/active_model/callbacks.rbの修正です。

不足していたactive_support/core_ext/hash/keysのrequireを追加しています。


Merge pull request #34832 from gmcgibbon/db_system_change_command

railtiesの修正です。

databaseの設定を変更する為のdb:system:changeコマンドを追加しています。

最初sqlite3を使うようrails newでアプリを作成したが、その後PostgreSQLMySQLを使う事になった場合に使用する、databaseの設定変更用のコマンドです。

やっている事は、Gemfileへの必要なgemの追加と、config/database.ymlの変更処理です。

$  bin/rails db:system:change --to=postgresql
    conflict  config/database.yml
Overwrite /config/database.yml? (enter "h" for help) [Ynaqdhm] y
       force  config/database.yml
        gsub  Gemfile

Minimize boilerplate setup code for JavaScript libraries

JavaScript librariesを使用するコードのexampleがimport + startを別の行にやっていたのを、request + startで1行で行うよう修正しています。

例。

- import * as ActiveStorage from "@rails/activestorage"
- ActiveStorage.start()
+ require("@rails/activestorage").start()

Merge pull request #34941 from rmacklin/allow-actioncable-to-run-in-web-workers

Action Cableの修正です。

consoleWebSocketを使用するのにreceiverにwindowを使用していたのを、selfを使用するよう修正、及び、addEventListenerremoveEventListenerから明示的なreceiverの指定を削除しています。

web workerで使用出来るようにする為(web workerではwindowやdocumentは使用出来ない)。


Add a space in framework names. Matches Active Record in generated Gemfile.

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

コメントにあるコンポーネント名を正式名称(スペース入りの値)に修正しています。


Merge pull request #33419 from bogdanvlviv/update-active_storage

Active Storage、railtiesの修正です。

app:update実行時にactive_storage_attachments tableからactive_storage_blobsに外部キー制約を貼る為のmigrationを生成するよう修正しています。

元々は外部キー制約は無くて、後から追加された([Add a foreign-key constraint to the active_storage_attachments table for blobs)で追加された)為。