なるようになるブログ

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

rails commit log流し読み(2016/12/10)

2016/12/10分のコミットです。

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

activerecord/CHANGELOG.md


Show message if Yarn is not installed (#27312)

railties/lib/rails/generators/rails/app/templates/bin/yarnの修正です。

yarn binstub実行時に、yarnコマンドが存在しなかった場合、その旨ワーニングメッセージを表示するよう修正しています。


Emulate db trigger behaviour for after_commit :destroy, :update

activerecord/lib/active_record/persistence.rbactiverecord/lib/active_record/transactions.rbの修正です。

同じDBのレコードに対する削除や更新が複数回行われてしまった場合に、after_commit callbackがその回数分実行されてしまったのを、一度だけcallback処理が行われるよう修正しています。


Do not raise exception when content_type is a empty string

actionpack/lib/action_dispatch/http/response.rbの修正です。

content_typeが空だった場合に、content typeのパース処理でエラーになってしまっていたのを修正しています。


Add a changelog entry for #25451 [ci skip]

activerecord/CHANGELOG.mdの修正です。

NOT NULL violationでエラーになった場合にStatementInvalidではなくNOT NULL violation用のエラークラス(NotNullViolation)をraiseするよう修正した対応(Translate NOT NULL violation to the specific exception)についてCHANGELOGにエントリーを追加しています。


Basic --webpack delegation to new webpacker gem (#27288)

railties/lib/rails/generators/app_base.rbrailties/lib/rails/generators/rails/app/app_generator.rbの修正です。

rails newコマンドにwebpackオプションを追加しています。webpackオプションを指定した場合、Gemfilewebpacker gemを追加、及び、webpacker:installコマンドが実行されるようになっています。


Use GitHub webpacker until closer to release

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

先に追加されたwebpacker gemをGemfileに追加する際、GitHubリポジトリを指定するよう修正しています。まだgemがリリースされてない為。


gemfile entry method need to return an empty array rather than nil (#27318)

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

先のwebpackオプションの追加対応で追加されたwebpacker_gemfile_entryメソッドの戻り値をnilからArrayに修正しています。Gemfileにエントリーを追加するようのメソッドは既存のロジックの都合上、Arrayを返す必要がある為。


run webpack command only when webpack option is specified

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

webpack用のコマンド(webpacker:install)がrails new実行時に必ず実行するようになっていたのを、webpackオプションを指定した場合のみ実行するよう修正しています。


Merge pull request #25227 from kamipo/numeric_value_out_of_range

Active Recordの修正です。

insert or update実行時にNumeric Value Out Of Rangeでエラーになった場合に、StatementInvalidではなく、専用用のエラークラス(ActiveRecord::RangeError)をraiseするよう修正しています。


Merge pull request #25280 from kamipo/prevent_range_error_for_belongs_to_associations

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

foreign key attributeにOut Of Range Errorが発生してしまう値を指定している状態で、belongs_to associationにアクセスした場合にRangeErrorが発生してしまっていたのを、エラーはraiseせずにnilを返すよう修正しています。


Fix CI failure caused by #25227 and #25280 were merged at the same time

activerecord/lib/active_record/associations/singular_association.rbactiverecord/test/cases/associations/belongs_to_associations_test.rbの修正です。

先のActiveRecord::RangeErrorの対応とbelongs_to associationの対応を同時にマージした事によりコケてしまったテストがあったのを修正しています。


Add a changelog entry for #25227 [ci skip]

activerecord/CHANGELOG.mdの修正です。

先のActiveRecord::RangeErrorを追加した対応についてCHANGELOGにentryを追加しています。