なるようになるブログ

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

rails commit log流し読み(2018/11/20)

2018/11/20分のコミットです。

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

actionview/CHANGELOG.md

actionmailer/CHANGELOG.md


allow right to left styling of docs (#3)

rails guideの修正です。

guideのテキストをを右から左に表示する為のcssを追加しています。デフォルトでは当然使われず、RTL環境変数に値が指定されている場合のみ使用されるようになっています。

PRに貼られている画像を見る限り、恐らくguideをアラビア語(?)に翻訳する為、のようです。

48672676-916c5e00-eb41-11e8-9bd8-c1bcb85ceb1d.png (2880×1498)

48672680-9c26f300-eb41-11e8-83be-4a478d677bb0.png (2644×1626)


Merge pull request #34476 from y-yagi/fix_no_method_error_in_parallelization

activesupport/lib/active_support/testing/parallelization.rbの修正です。

parallel testsでテスト結果がDRb::DRbUnknownになった場合(テスト実行側ではmarshal出来ていたがテスト結果をまとめるサーバ側でunmarshal出来ない場合)に、 テスト結果表示時にNoMethodErrorでエラーになってしまっていたのを、テスト結果が正しく表示されるよう修正しています。


Merge pull request #34410 from gmcgibbon/test_support_windows

activesupport/lib/active_support/notifications/instrumenter.rbactivesupport/lib/active_support/testing/parallelization.rbの修正です。

Windows向けのサポートとして、下記を行っています。

  • parallel testsで強制的にdrb/unixをrequireしていたのをWindowsの場合はrequireしないよう修正(Windowsだとdrb/unixをrequireするとエラーになる為)
  • デフォルトで生成されるtest/test_helper.rbWindowsの場合、parallel testのworkerにスレッドを使用するよう修正(Windowsだとプロセスが使用出来ない為)
  • InstrumenterWindowsの場合はProcess::CLOCK_PROCESS_CPUTIME_IDを使用しないよう修正

Merge pull request #34453 from bogdanvlviv/exercise-connected_to-and-connects_to

activerecord/lib/active_record/connection_handling.rbactiverecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rbの修正です。

ActiveRecord::Base.connected_toの戻り値がconnectionのArrayであることを確認するテスト、及び、connected_todatabaserole引数両方指定した場合にエラーになる事を確認するテストを追加しています。


Merge pull request #34482 from jacobherrington/chore/add-comments-to-templates

.github/issue_template.md.github/pull_request_template.mdの修正です。

GitHubで使用されるissue template、pull request templateで、説明部分はmarkdownのコメント(<!-- ... -->)として扱い、表示はされないよう修正しています。


Permit ActionController::Parameters for serializable Hash

activejob/lib/active_job/arguments.rbの修正です。

ActiveJobの引数にActionController::Parametersクラスのインスタンスを指定出来るよう修正しています。


Merge pull request #34085 from albertoalmagro/display-help-as-command-line-guides

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

rails helpでコマンドを表示する際に、railsのコマンドとrakeのタスクをそれぞれ別に表示していたのを、全てまとめて表示するよう修正しています。


Merge pull request #34488 from mullican/word_wrap_preserve_left_side_whitespace

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

ActionView::TextHelper#word_wrapメソッドで行の左側のスペースについてはtrimしないよう修正しています。

    This is a paragraph with an initial indent,
followed by additional lines that are not indented,
and finally terminated with a blockquote:
  "A pithy saying"

上記のようなテキストがあった場合、元は、

This is a paragraph
with an initial indent,
followed by additional
lines that are not
indented,
and finally terminated
with a blockquote:
"A pithy saying by a
wise person"

このように行左側のスペースがtrimされてしまっていのたを、

    This is a paragraph
with an initial indent,
followed by additional
lines that are not
indented,
and finally terminated
with a blockquote:
  "A pithy saying by a
wise person"

のように、元のスペースは維持するようになっています。


Merge pull request #20865 from colavitam/only-except-behavior

actionpack/lib/action_dispatch/routing/mapper.rbの修正です。

resource(s)メソッドで、onlyexceptオプションを同時に指定できなかった(指定した場合onlyだけが使用されていたのを)のを、指定出来るよう修正しています。

が、大分混乱を招く書き方(e.g. resources :products, only: [:show, :destroy], except: :destroy)なので、基本的には推奨しないとの事です。


Merge pull request #22534 from evopark/master

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

mail送信用のmultipart format blockで、使用されるテンプレート名がaction name固定だったのを、任意の値を指定出来るよう修正しています。

mail(template_name: template_name) do |format|
  format.text
  format.html
end

上記のようにtemplate_nameオプションで指定出来るようになっています。


Deprecate event.end = Time.now in favor of event.finish!

activesupport/lib/active_support/notifications/instrumenter.rbの修正です。

Notifications::Event#end=をdeprecateにしています。

Notifications::Eventが保持するデータに、cpu time, idle time等を追加した、 Add cpu time, idle time, and allocations features to log subscriber events の対応により、end=は使用されず、代わりにfinish!を使用する必要がある為。