2017/09/01分のコミットです。
CHANGELOGへの追加はありませんでした。
Ignore files already deleted on GCS file deletions
activestorage/lib/active_storage/service/gcs_service.rbの修正です。
ActiveStorage::Service::GCSService#deleteメソッドでファイルが既に削除済みだった場合(Google::Cloud::NotFoundErrorが発生した場合)はエラーを無視するよう修正しています。
Fix can't modify frozen String error in XmlMini_JDOM
activesupport/lib/active_support/xml_mini/jdom.rbの修正です。
XmlMini_JDOM moduleでcan't modify frozen Stringエラーが発生してしまうバグがあったのを修正しています。
Have attachments touch their records
activestorage/app/models/active_storage/attachment.rbの修正です。
attachmentsを更新したらrecordも更新するよう、touchオプションを設定しています。
- belongs_to :record, polymorphic: true + belongs_to :record, polymorphic: true, touch: true
Merge pull request #29233 from matthewd/redefine-method
Active Supportの修正です。
Rubyのwarningを出さずにメソッドの再定義を行う為の、silence_redefinition_of_methodメソッドを追加しています。
普通にメソッドを再定義しようとすると既にメソッドがある為Rubyのwarningが発生します。それを避ける為、今まではremove_possible_methodメソッドを先に呼び出してメソッドを未定義にするようにしていました(redefine_methodメソッド内でもそのような挙動になっています)。が、メソッドを再定義する、という事をする為にメソッドを未定義にする、というのは目的がわかりにくいのでは、という事で新たにremove_possible_methodを使用せずに再定義するメソッドが追加されました。
実装は下記の通りです(Ruby 2.3以降の場合)。
# Marks the named method as intended to be redefined, if it exists. # Suppresses the Ruby method redefinition warning. Prefer # #redefine_method where possible. def silence_redefinition_of_method(method) if method_defined?(method) || private_method_defined?(method) # This suppresses the "method redefined" warning; the self-alias # looks odd, but means we don't need to generate a unique name alias_method method, method end end
alias_methodを使用して対応しているんですねえ。
Remove needless silence_warnings
ailties/test/application/configuration_test.rbの修正です。
environmentファイルのrequire処理をsilence_warningsで囲むようにしていたのを、silence_warningsを削除しています。
元々はSassで大量に発生するRubyのwarning出力を抑止する為だったのですが、現状リリースされているSassではもうwarningは出ないようになっている為。
double assign is no longer an effective workaround for unused variable warning
actionview/lib/action_view/template.rbの修正です。
ActionView::Template#locals_codeメソッドでkeyの設定処理にダブルアサインを使用していたのを、使用しないよう修正しています。
- locals.each_with_object("".dup) { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" } + locals.each_with_object("".dup) { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" }
Rubyのwanring(assigned but unused variable)を避ける為にダブルアサインを使用していたらしいのですが、Ruby 2.5では上記テクニックが使えなくなった(普通にwarningが出るようになった)為、修正したとの事です。
参考:ruby-trunk-changes r59584 - r59586 - PB memo
Suppress “unused variable” in Ruby 2.5
activesupport/test/test_case_test.rbの修正です。
local_scope変数の設定処理にダブルアサインを使用していたのを、使用しないよう修正しています。理由は先のコミット同様。
Hash#transform_keys is in Ruby 2.5+
activesupport/lib/active_support/core_ext/hash/keys.rbの修正です。
Hashにtransform_keysメソッドが定義されていない場合のみメソッドを定義するように修正しています。Ruby 2.5ではRuby本体にHash#transform_keysメソッドが定義されている為。
actionpack/test/dispatch/response_test.rbの修正です。
使用していない変数の変数名の先頭に_を追加しています。
- status, headers, body = app.call(env) + _status, headers, _body = app.call(env)
戻り値が複数あって一部値は使用している為上記のような対応を行っています。
:warning: assigned but unused variable - message
activerecord/test/cases/associations/join_model_test.rbの修正です。
使用していない変数を削除しています。
actionpack/lib/action_controller/metal/rendering.rbの修正です。
使用していないactive_support/core_ext/string/filtersのrequireを削除しています。
CI with the latest stable(GA) version of MariaDB 10.2
.travis.ymlの修正です。
CIで使用するMariaDBのバージョンを10.2に更新しています。
Skip test_remove_column_with_multi_column_index
activerecord/test/cases/migration/columns_test.rbの修正です。
test_remove_column_with_multi_column_indexをMariaDB、かつ、MariaDBのバージョンが10.2.8以上の場合実行しないよう修正しています。
MariaDB 10.28から、複数列のUNIQUE制約の一部である列を削除することはできなくなった為、との事です。
参考:DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]
add_reference should respect column position for both reference id and type columns
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rbの修正です。
add_referenceメソッドでpolymorphicオプションにtrueを指定した場合に、カラムポジションの指定が正しく動作しないバグがあったのを修正しています。