なるようになるブログ

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

rails commit log流し読み(2015/10/17)

2015/10/17分のコミットです。

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

activesupport/CHANGELOG.md


Merge pull request #21953 from bdunne/fix_dep_warn

activesupport/lib/active_support/deprecation/method_wrappers.rbactivesupport/lib/active_support/testing/deprecation.rbの修正です。

ActiveSupport::Deprecation#deprecate_methodsでdeprecatorに、自身のインスタンスを設定するよう修正しています。これにより、deprecateメッセージに表示させるクラス名/モジュール名が、指定したクラス名/モジュール名に変わっています。

実行例。

ActiveSupport::Deprecation.new("next-release", "MyGem").deprecate_methods(MyModule, :aaa)
# => [:aaa]

# before
MyModule.aaa
# => DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.0. (called from irb_binding at (irb):7)

# after
MyModule.aaa
# => DEPRECATION WARNING: aaa is deprecated and will be removed from MyGem next-release. (called from irb_binding at (irb):7)

Move the handling of supported arguments to where

activerecord/lib/active_record/relation/query_methods.rbactiverecord/lib/active_record/relation/where_clause_factory.rbの修正です。

先日行われた、Active Recordのwhereメソッドに使用できない型のオブジェクトが渡された場合にArgumentErrorをraiseするようにした対応を、whereメソッドではなく、WhereClauseFactory#buildで行うよう対応しています。

ちなみに、この対応が原因でActive Recordのテストが壮大に壊れている(本来通るべき型がエラーになってしまうようになってしまった)ので、後でまだ修正が入りそうです。


[ci skip] Add backend queue starting documentation

rails guideのActive Job Basicsの修正です。

Starting the Backendの項を追加し、各バックエンドシステムの、Active Jobを使用した場合の使い方について説明したdocへのリンクを追加しています。 当然、Active Jobを使用した場合の使い方のdocがあるものだけのようです。


Use "rake time:zones:all" instead of "rake -D time" [ci skip]

activesupport/lib/active_support/railtie.rbrailties/lib/rails/generators/rails/app/templates/config/application.rbの修正です。

time zoneの確認をさせる際、rake -D timeでtimeに関するタスクを表示するのではなく、rake time:zones:allで直接time zoneの一覧を表示させるよう修正しています。


Suppress warnings of assigned but unused variable

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

whereメソッドのテストから、使用していない変数を削除しています。