なるようになるブログ

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

rails commit log流し読み(2015/09/19)

2015/09/19分のコミットです。

activesupport/CHANGELOG.md


DRY enum conflict detection

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

detect_enum_conflict!メソッドenum名が既存のメソッド名とコンフリクトした際にエラーをraiseする処理が、チェックする処理毎に同じ内容を記載していたのを、メソッドに切り出して共通化しています。。


Include interpolation values to translation_missing helper

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

translateメソッドで、指定されたkeyが見つからない場合に表示されるエラー用のタグのタイトルに、translateメソッドのオプションに指定された値も表示するよう修正しています。


Added test for any if called without specifying any format

actionmailer/test/base_test.rbactionmailer/test/base_test.rbの修正です。

mailメソッドで、formatの指定にanyメソッドを使用、かつformatを一つも指定しなかった場合のテストを追加しています。


move parameter parsing to the request object

actionpack/lib/action_dispatch/http/request.rbactionpack/lib/action_dispatch/middleware/params_parser.rbの修正です。

parmeterのパース処理をParamsParserクラスからRequestクラスに移動しています。

parameterを取得するのはRequestオブジェクト経由からなので、そちらにパース処理があるのが適切だろう、という理由のようです。


remove the default parameter from the parser method

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

parameterのパース処理から、defaultパラメータを削除しています。

元々はdefaultを定義するのにstragyパターンを使用していたのですが、使用しているパターンがdefaultのみで、他のパターンが無かった為、値をブロックで渡すよう修正しています。


pull normalize_encode_params up

actionpack/lib/action_dispatch/http/request.rbactionpack/lib/action_dispatch/middleware/params_parser.rbの修正です。

normalize_encode_paramsメソッドの呼び出しを、Request#POSTメソッドでrequestオブジェクトにrequest parametersを設定する際に行うよう修正しています。

normalize_encode_paramsは全てのparserで必要な共通処理の為、値を設定する際に行ってしまうようにしたとの事です。


only wrap the strategy with exception handling

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

Request#parse_formatted_parametersメソッドで、メソッド全体をrescueしていたのを、strategy処理の呼び出し部分のみ、begin/rescueで囲うよう修正しています。

エラー発生箇所をただしく把握出来るよにする為、との事です。


stop eagerly parsing parameters

actionpack/lib/action_dispatch/middleware/params_parser.rbの修正です。

ParamsParser#callメソッドで行っていたrequestオブジェクトへのrequest_parametersの設定処理を削除しています。


push the parameter parsers on to the class

actionpack/lib/action_dispatch/http/parameters.rbactionpack/lib/action_dispatch/http/request.rbactionpack/lib/action_dispatch/middleware/params_parser.rbの修正です。

parameterのパース処理をActionDispatch#Http#Parameters moduleに移動しています。

middlewareスタックはRailsアプリケーション内でシングルトンな為、パラメータパーサを設定する機会は一度しか無いのですが、これをrequest class毎に設定出来るようにする為に、処理を移動させたとの事です。


let the guides home point to the new release series endpoints [ci skip]

guides/source/_welcome.html.erbの修正です。

rails guideにある各railsバージョンへのリンクを、元々PATCHバージョンまで指定していたのを、MINORバージョンまでのみ指定するよう修正しています。PATCHバージョンについては指定せずとも、自動で最新のバージョンものを表示してくれるよう対応したとの事です。


do not instantiate a param parser middleware

actionpack/lib/action_dispatch/middleware/params_parser.rbの修正です。

parameter parse処理を移動した事により、ParamsParser middlewareのインスタンスを生成する必要が無くなったので、インスタンスを生成しないよう処理を修正しています。


remove the request parameter from parse_formatted_parameters

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

parse_formatted_parametersメソッドの引数から不要なrequest変数を削除しています。

parse_formatted_parametersメソッドを呼び出すのはrequestオブジェクト自身なので、自身を引数に指定する必要は無い為。


remove setting request parameters for JSON requests

actionpack/lib/action_controller/test_case.rbの修正です。

assign_parametersメソッドで、JSON requestの場合独自にパラメータをパース、及びrequest_parametersへの値の設定を行っていたのでうが、parse_formatted_parametersメソッドで値のパースを行うようにした為、独自に値を設定する必要はなくなった為、値の設定処理を削除しています。


let the request object handle parsing XML posts

actionpack/lib/action_controller/test_case.rbの修正です。

TestRequestクラスでXML postsをパース出来るように、パース処理を追加しています。


all parameter parsing is done through the request object now.

actionpack/lib/action_controller/test_case.rbの修正です。

不要なrequest_parametersへの値の設定処理を削除しています。


remove outdated comment

actionpack/lib/action_controller/test_case.rbの修正です。

assign_parametersメソッドから今回の対応により不要になったコメントを削除しています。


mostly remove the ParamsParser middleware

各doc、テストファイル等からActionDispatch::ParamsParser middlewareの説明、読み込み処理等を削除しています。


nodoc raw_write_attribute

activerecord/lib/active_record/attribute_methods/write.rbのdocの修正です。

private APIであるraw_write_attributeメソッド:nodoc:を追加しています。


Fixed unclosed tags in kindle guide source [ci skip]

guides/source/kindle/layout.html.erbguides/source/kindle/toc.ncx.erbの修正です。

kindle guide用viewファイルでhtmlのタグが閉じてない部分があったので、閉じタグを追加しています。


Replace #=> with # => [ci skip]

各docの修正です。

doc内のexampleで実行結果を表示する箇所で、#=>という風に#=の間にスペースが無い箇所があったのを、スペースを追加しています。

->> person.errors.details[:name] #=> [{error: :blank}]
+>> person.errors.details[:name] # => [{error: :blank}]

change test method name to the appropriate name

actionmailer/test/base_test.rbの修正です。

テストメソッド名がtestとなっている箇所があったのを、適切なテスト名に修正しています。


Corrected numeric conversions output [ci skip]

activesupport/lib/active_support/core_ext/numeric/conversions.rbのdocの修正です。

Numeric#to_formatted_sメソッドのexampleの実行結果が、実際の結果と異なっている箇所があったのを修正しています。


Replaced ThreadSafe::Map with successor Concurrent::Map.

ThreadSafe::Cacheクラスを使用している箇所を、Concurrent::Mapクラスを使用するよう修正しています。

thread_safe gemはdeprecateになり、そのコードは全てconcurrent-ruby gemにマージされたとの事です。で、Concurrent::MapクラスはThreadSafe::Cacheとまったく同じ機能を提供するようになっている為、そちらを使用するようにしたとの事です。


Merge pull request #21669 from amitsuroliya/improve_docs

activesupport/lib/active_support/core_ext/module/attribute_accessors.rbのdocの修正です。

mattr_readerメソッドのexampleの実行結果が、実際の結果と異なっている箇所があったのを修正しています。