2017/05/12分のコミットです。
CHANGELOGへの追加はありませんでした。
Merge pull request #29043 from kamipo/dont_eager_loading_if_unneeded_for_exists
activerecord/lib/active_record/relation.rb、
activerecord/lib/active_record/relation/finder_methods.rbの修正です。
FinderMethods#exists?メソッドで不要なeager load処理を行わないよう修正しています。
Merge pull request #29040 from eugeneius/parameters_delete_block
actionpack/lib/action_controller/metal/strong_parameters.rbの修正です。
ActionController::Parameters#deleteメソッドに、Hash#deleteメソッド同様に引数に結果を返すようのblockを指定出来るよう修正してます。
元々Rails 4.2系までは指定出来るようになっていたのですが、Rails 5.0で誤って指定出来なくなってしまっていて、再度指定出来るよう修正しています。
Merge pull request #29034 from peterjm/handle_loops_in_exception_handling
activesupport/lib/active_support/rescuable.rbの修正です。
Rescuable#rescue_with_handlerメソッドで、cause chainに既に発生したExceptionが含まれていた場合、causeの取得処理を停止するよう修正しています。
def rescue_with_handler(exception, object: self) + def rescue_with_handler(exception, object: self, visited_exceptions: []) + visited_exceptions << exception + if handler = handler_for_rescue(exception, object: object) handler.call exception exception elsif exception - rescue_with_handler(exception.cause, object: object) + if visited_exceptions.include?(exception.cause) + nil + else + rescue_with_handler(exception.cause, object: object, visited_exceptions: visited_exceptions) + end
上記のような場合に、Ruby 2.3系だとSystemStackErrorが発生してしまう為との事です。なお、Ruby 2.4.1では左記問題は発生しません。
Merge pull request #29029 from timolehto/master
railties/lib/rails/test_unit/railtie.rbの修正です。
rails -Tやrails -Dのようにrake task一覧を表示するコマンドを実行した場合に、RAILS_ENVがtestに設定されてしまっていたのを、development`が設定されるよう修正しています。
Merge pull request #28919 from meinac/fix_ambigious_exception_message_of_select_query_method
activerecord/lib/active_record/relation/query_methods.rbの修正です。
Active Recordのselectメソッドの引数にフィールドを指定しなかった場合のエラーメッセージで、メソッド名を明確に表示するよう修正しています。
- raise ArgumentError, "Call this with at least one field" if fields.empty? + raise ArgumentError, "Call `select' with at least one field" if fields.empty?