なるようになるブログ

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

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

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

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

actionmailbox/CHANGELOG.md

actionpack/CHANGELOG.md

actionview/CHANGELOG.md

activerecord/CHANGELOG.md


Merge pull request #36372 from instructure-bridge/6-0-stable

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

deprecateになっているActiveRecord::Base.configurationsのeach及びfirst`の戻り値が5.2までと同じにるよう修正しています。


Fix Bcc header missing with emails from conductor and test helpers

actionmailbox/lib/action_mailbox/test_helper.rbの修正です。

Action Mailerのtest helperメソッド(create_inbound_email_from_mail等)でBccが含まれないバグがあったのを修正しています。


Merge pull request #36213 from st0012/fix-25842

Action Packの修正です。

responseにAccept headerを使用する時、Vary: Accept headerも含むよう修正しています。Varyの指定が無いと、ブラウザが誤ったコンテンツをcacheしてしまう可能性がある(Accept headerに指定したmimeが使用されない可能性がある)為。

参考: Missing Vary Header


Merge pull request #36764 from willianveiga/feature/inputs-inside-disabled-fieldset-are-not-submited-on-remote-true-forms

actionview/app/assets/javascripts/rails-ujs/utils/form.coffeeの修正です。

remote formでdisabledになっているfieldset配下のinputタグの値が送信されてしまうバグがあったのを修正しています。


Optimize Journey::Route#glob?

actionpack/lib/action_dispatch/journey/route.rbの修正です。

Journey::Route#glob?grep + empty?を使用していたのを、any?を使用するようリファクタリングしています。高速化の為。


Merge pull request #36702 from cpruitt/raise-on-transliterate-ascii-8bit

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

ActiveSupport::Inflector.transliterateに変換出来ない不正なencodingの文字列(UTF-8, US-ASCII, GB18030以外)を指定した場合に、ArgumentErrorをraiseするよう修正しています。


Use a single term instead of all terms used to describe path and URL helpers together

named route helperについて説明する際に、説明している箇所によって用語が異なっていた("named helpers"や"route helpers"という言い方をしていた)のを、全て"named route helper"を使用するよう修正しています。


Added a phone_to helper method, on the style of mail_to and sms_to. (#36775)

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

TEL anchor link tagを生成する為のphone_toメソッドを追加しています。

phone_to "1234567890" # => <a href="tel:1234567890">1234567890</a>
phone_to "1234567890", "Phone me" # => <a href="tel:134567890">Phone me</a>
phone_to "1234567890", "Phone me", country_code: "01" # => <a href="tel:+015155555785">Phone me</a>

Change the test description to say the URL helper name in test.

actionview/test/template/url_helper_test.rbの修正です。

sms_toメソッドに関するテストのテスト名をtest_sms_toからはじめるよう修正しています。


Fix error 500 caused by ActionController::RoutingError (via fail-safe) when POST parameters are invalid (#29985)

actionpack/test/dispatch/request_test.rbの修正です。

不正なparameterを送信した際にformatメソッドがエラーにならない事を確認するテストを追加しています。


Merge pull request #36227 from betesh/avoid-misleading-error-about-late-attachments

actionmailer/lib/action_mailer/base.rbの修正です。

mailメソッド呼び出し後にinline attachmentsを参照するとエラーになってしまうバグがあったのを修正しています。


Merge pull request #36178 from sshaw/fix_time_zone_options_priority

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

time_zone_options_for_selectメソッドのdoc内、のmodel引数について説明している箇所に、time zoneのobjectに実装が必要な処理についての説明を追加しています。


Remove tough to grasp -1 + 1 = 0 from String#to

activesupport/lib/active_support/core_ext/string/access.rbの修正です。

String#toメソッドの引数にStringの長さ以上の負の値が指定された場合(e.g. 5文字のStringに対して"-7"が指定された)の挙動のリファクタリングを行っています。


Change test description with the correct URL name

actionview/test/template/url_helper_test.rbの修正です。

mail_tophone_toメソッドに関するテストのテスト名をそれぞれtest_mail_totest_phone_toになるよう修正しています。


Allow separate database env variables per-connection

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

DATABASE_URL envはprimary connectionにのみ使用されるよう修正しています。合わせて、primary以外のconnection用にspec name + DATABASE_URL(e.g. ANIMALS_DATABASE_URL)というenvを使用出来るよう修正しています。


Fix "warning: ambiguous first argument; put parentheses or a space even after `/' operator"

actionpack/test/dispatch/request_test.rbの修正です。

Rubyのwarning("ambiguous first argument; put parentheses or a space even after `/' operator")が出ていたのを修正しています。


Do not use the same temp file in different tests

railties/test/commands/credentials_test.rbの修正です。

異なるテストで同じ名前の一時ファイルを使っていたのを、テスト毎に違う一時ファイルを使うよう修正しています。


Use assert_match / assert_no_match for asserting match

actionpack/test/dispatch/mime_type_test.rbactivesupport/test/time_zone_test.rbの修正です。

正規表現に一致する / しない事を確認するのにassert / assert_notを使っている箇所があったのを、assert_match / assert_no_match を使うよう修正しています。


Use match? where we don't need MatchData

正規表現に一致しない事を確認するのに!~を使用していたのを! + match?を使用するよう修正しています。


Avoid to use a method that acts on the hash

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

deprecateになった、ActiveRecord::Base.configurationsの戻り値がHashである事に依存しているメソッドを使用している箇所があったのを修正しています。