なるようになるブログ

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

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

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

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

activesupport/CHANGELOG.md

activerecord/CHANGELOG.md


Move all npm packages to @rails scope

Railsで提供しているnpm packages(rails-ujsactivestorageactioncableactiontext)を、webpacker同様に@rails namespace配下に移動(@rails/actioncable@rails/actiontext@rails/activestorage@rails/ujs)しています。

名称の変更だけで実際のリリースはまだです。なお、古い名称のpackageは削除等はされないため、古いバージョンについては引き続き使用出来ます。


Add Postmark to the ingress lists [ci skip]

actionmailbox/README.mdrails guideのAction Mailbox Basicsの修正です。

サポートしているサービスのリストにPostmarkを追加しています。


Merge pull request #34892 from kbrock/safer_safe_constantize

activesupport/lib/active_support/inflector/methods.rbの修正です。

不正な定数名を指定した場合に、String#safe_constantizeLoadErrorをraiseしてしまう場合があったのを、メソッド内でLoadErrorをrescueし、メソッドとしてはnilを返すよう修正しています。


Add reasoning for I18n.with_locale and explanation that the problem is

rails guideのRails Internationalization (I18n) APIの修正です。

Managing the Locale across Requestsの項に、何故I18n.with_localeメソッドを使う必要があるのかについての説明を追加しています。


Fix typo in collection_radio_buttons spec [ci skip]

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

collection_radio_buttonsメソッドのdoc内のタイポを修正しています。


Replace secrets with credentials in comments

railtiesの修正です。

database.ymlのテンプレートファイルのコメント内、センシティブな情報を扱うファイルのファイル名がconfig/secrets.ymlになっていたのを、config/credentials.ymlに修正しています。


Refactor build_relation in the uniqueness validator to avoid low level predicate construction

Active Recordの修正です。

uniqueness validatorのbuild_relationメソッドでlow levelのpredicateの組み立て処理を行わないようリファクタリングしています。


Refactor bind_attribute to expand an association to actual attribute

activerecord/lib/active_record/relation.rbactiverecord/lib/active_record/validations/uniqueness.rbの修正です。

uniqueness validatorのbuild_relationメソッドで行っていたattributeの取得処理を、relationのbind_attributeで行うようリファクタリングしています。


Fix test_case_insensitiveness to follow up eb5fef5

activerecord/test/cases/adapters/postgresql/case_insensitive_test.rbの修正です。

先の、Refactor build_relation in the uniqueness validator to avoid low level predicate constructionの修正によりtest_case_insensitivenessのテストが失敗するようになっていたのを修正しています。


Remove id_value argument which is no longer passed to sql_for_insert

activerecord/lib/active_record/connection_adapters/abstract/database_statements.rbactiverecord/lib/active_record/connection_adapters/postgresql/database_statements.rbの修正です。

PostgreSQL::DatabaseStatements#sql_for_insertメソッドの引数から使用されてないsql_for_insertを削除しています。


Add info about config.action_mailer.delivery_job to the guide [ci skip]

rails guideのConfiguring Rails Applicationsの修正です。

config.action_mailer.delivery_jobについての説明を追加しています。


Support endless ranges in where

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

Ruby 2.6で追加されたendless rangesのサポートを追加しています。endless rangeが指定された場合、infinityが指定されたのと同じ振る舞いをするようになっています。

# before
User.where(id: 1..).to_sql
# => "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" BETWEEN 1 AND NULL"


# after
User.where(id: 1..).to_sql
#=> "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" >= 1"