なるようになるブログ

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

rails commit log流し読み(2017/11/05)

2017/11/05分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #31046 from NARKOZ/fix-capybara-webkit-deprecation

actionpack/lib/action_dispatch/system_testing/driver.rbの修正です。

System Testでwindow sizeを変更するのにdeprecateになっていたWebkit::Driver#resize_windowメソッドを使用していたのを、resize_window_toメソッドを使用するよう修正しています。


Generate the correct path in nested scaffold generator

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

namespaced scaffold generatorが生成するpathが誤った内容になっており、generatorで生成したファイルが正しく動作しなかったのを修正しています。


Show RequestForgeryProtection methods in api doc [ci skip]

actionpack/lib/action_controller/metal/request_forgery_protection.rbのdocの修正です。

RequestForgeryProtection moduleの一部メソッド(form_authenticity_param等)がAPI docに表示されなくなってしまっていたのを、再度表示されるよう対応しています。

定数(CROSS_ORIGIN_JAVASCRIPT_WARNING)をdocに表示されないようにする為に、Add nodoc to some constants [skip ci]で定数の前に:nodoc:を追加しているのですが、その影響で、その:nodoc:より下に定義されているメソッドがすべて表示されなくなってしまっていました。

rails commit log流し読み(2017/11/04)

2017/11/04分のコミットです。

CHANGELOGへの追加はありませんでした。


Permit configuring Active Storage's job queue

Active Storageの修正です。

Active Storageで使用するjobのqueue名を変更出来るよう修正しています。値はconfig.active_storage.queue経由で指定出来るようになっています。なお、job毎での変更ではなく、Active Storageで使用するjobすべてで同じ値が使われるようになっています(今のところ)。


Improve docs of ActionDispatch::Routing::Mapper

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

ActionDispatch::Routing::Mapperクラスのdocのフォーマットの修正、実行例を追加、別メソッドへのリンクを追加、等を行っています。


Remove unused calculate_rounded_number and digit_count

activesupport/lib/active_support/number_helper/number_to_rounded_converter.rbの修正です。

使用していないNumberToRoundedConverterクラスのcalculate_rounded_numberメソッド及びdigit_countメソッドを削除しています。


s/an/a/

railties/test/application/middleware/exceptions_test.rbの修正です。

テスト名をタイポしている箇所があったのを修正しています。


Merge pull request #31014 from aditya-kapoor/doc-fixes

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

parameterizeメソッドのdoc内のparameterizeメソッドに、Stringにダッシュ(-)とアンダースコア(_)が含まれていた場合の挙動についての説明を追加しています。

rails commit log流し読み(2017/11/03)

2017/11/03分のコミットです。

CHANGELOGへの追加はありませんでした。


Edited comment from request.rb

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

send_early_hintsメソッドのdocのグラマーの修正を行っています。


Allow third-party previewers/analyzers to customize their tempdirs

activestorage/lib/active_storage/downloading.rbactivestorage/lib/active_storage/previewer.rbの修正です。

独自のpreviewers/analyzersでtempdirをカスタマイズ出来るよう、tempdirの取得処理をメソッド(tempdir)に切り出しています。


Remove unused classes

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

使用していないエラー用のクラスを削除しています。


Specify bundler version in template files

bug report templatesの修正です。

Remove bundler 1.16.0 でCI上でbunlder 1.15.4を使用するよう対応したのですが、何故かまだ1.16.0が使われてしまうケースがある為、templateに直接bundler 1.16.0未満を使うようバージョン指定(gem "bundler", "< 1.16")を記載しています。


Revert "Merge pull request #31025 from y-yagi/follow_up_31023_part2"

CI上で既にインストール済みのbunlderをuninstallするよう対応した、Remove bundler 1.16.0をRevertしています。templateに直接バージョン指定を記載するようにし、uninstallする必要が無くなった為。

rails commit log流し読み(2017/11/02)

2017/11/02分のコミットです。

CHANGELOGへの追加はありませんでした。


Ignore "gem "bundler" cannot be uninstalled because it is a default gem" error

.travis.ymlの修正です。

Remove bundler 1.16.0で既にインストール済みのbundlerを削除するようにしたのですが、その削除処理が失敗しても処理が継続するよう対応しています。

-  - "rvm @global do gem uninstall bundler --all --ignore-dependencies --executables"
+  - "rvm @global do gem uninstall bundler --all --ignore-dependencies --executables || true"

Ruby 2.5ではbundlerがデフォルトgemになっており、削除が出来ない(gem "bundler" cannot be uninstalled because it is a default gem というエラーが表示される)為。


Fix "warning: instance variable @defined_root not initialized"

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

AVLogSubscriberTestRubyのwarning(instance variable @defined_root not initialized)が出る場合があったのを修正しています。

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

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

CHANGELOGへの追加はありませんでした。


Fix grammar issue [ci skip]

RELEASING_RAILS.mdの修正です。

Send Rails release announcementsの項のグラマーの修正(カンマの追加)を行っています。


Address incorrect number of queries executed at Oracle enhanced adapter

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

DBにOracleを使用した場合に、SQLCounterで無視するqueryにall_sequencesからのselectを追加しています。

-    oracle_ignored     = [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im, /^\s*select .* from all_constraints/im, /^\s*select .* from all_tab_cols/im]
+    oracle_ignored     = [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im, /^\s*select .* from all_constraints/im, /^\s*select .* from all_tab_cols/im, /^\s*select .* from all_sequences/im]

Oracle enhanced adapter側で、独自のschema cachingを使用していたのをRailsが生成したscehema cacheを使用するよう最近変更したのですが、その影響で不要なSQLがカウントされるようになり、結果テストが失敗するようになってしまった為、上記対応を行ったとの事です。


Enable Style/RedundantReturn rubocop rule, and fixed a couple more

.rubocop.ymlStyle/RedundantReturn copを追加、及び書くファイルにルールを適用しています。


Fix failing bundle install on CI

Gemfile.lockの修正です。

バグレポートテンプレートについてのテストがCI上でエラーになってしまっていて、その対策としてbundle installを実行しています。

が、これだとまだ駄目で、対応が続きます。


Avoid bundler 1.16.0 for now

.travis.ymlの修正です。

CIで使用するbundlerを1.15.4に固定しています。

バグレポートテンプレートではinline gemfileを使用しているのですが、bundler 1.1.6.0でinline gemfileを使用した際にエラーになる事がある為。

参考:Problem with inline gemfiles in 1.16.0.pre2


Remove bundler 1.16.0

.travis.ymlの修正です。

bundler 1.15.4をインストールする前に、既にインストール済みのbundlerを削除するようにしています。

デフォルトでbundler 1.16.0がインストールされてしまい、そのままだとbundler 1.15.4をインストールしても1.16.0の方が使用されてしまうため。


Workaround for ActionMailer failures by not installing mail 2.7

Gemfileの修正です。

mail gemのバージョンを2.7未満に固定しています。

mail gem 2.7.0でAction Mailerのテストがコケてしまうため。


Fix tests on Mail 2.7

Gemfile、及び、Action Mailerのテストの修正です。

Gemfilemail gemのバージョンロックを削除、及び、Action Maiterのテストをmail 2.7.0で通るよう修正しています。


updates autoloading guide for Ruby 2.5 [ci skip]

rails guideのAutoloading and Reloading Constantsの修正です。

定数探索についての説明に、Ruby 2.5の場合の挙動について説明を追加しています。トップレベルの定数探索のルールが変更になった件等。

rails commit log流し読み(2017/10/31)

2017/10/31分のコミットです。

CHANGELOGへの追加はありませんでした。


Remove unused MissingRequestError

actionview/lib/action_view.rbactionview/lib/action_view/template/error.rbの修正です。

使用していないActionView::MissingRequestErrorクラスを削除しています。


Merge pull request #31004 from shuheiktgw/remove_unnecessary_returns

returnが不要な箇所(メソッドの最後の式)にreturnを使用している箇所があったのをまとめて削除しています。


Prevent source line wrapping in rescue layout

actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erbの修正です。

rescue layoutで、ソース行が改行されないよう、white-space: preを指定するよう修正しています。

    .line {
       padding-left: 10px;
+      white-space: pre;
     }

PRより。

before

after

rails commit log流し読み(2017/10/30)

2017/10/30分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #31002 from ta1kt0me/call_ajax_without_beforeSend

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

Rails.ajaxbeforeSendオプションが指定されているかのチェックを行い、beforeSendオプション指定されている場合のみbeforeSendを実行するよう修正しています。

-  unless options.beforeSend?(xhr, options)
+  if options.beforeSend? && !options.beforeSend(xhr, options)
    return false

beforeSendオプションを指定せずにRails.ajaxを使用出来るようにする為。


PolymorphicReflection#scopes is no longer used since a5651eb5

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

使用していないPolymorphicReflection#scopesメソッドを削除しています。


source_type_scope should respect correct table alias

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

polymorphic has_many through assocationsを使用しているtableを複数joinした際に、誤ったSQLが生成されてしまうバグがあったのを修正しています。