なるようになるブログ

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

rails commit log流し読み(2016/11/18)

2016/11/18分のコミットです。

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


Fix mucking of connection_config leading to issues in prepared_statements

activerecord/test/cases/adapters/postgresql/prepared_statements_test.rbの修正です。

prepared statementsのテストで、prepared_statementsの値を操作するのにconnection_configを使用していたのを、ActiveRecord::Base.connectionの値を直接操作するよう修正しています。


Remove mention of deprecated SafeERB gem from security docs for now, prior section already speaks about sanitization as a safety measure. [ci skip] (#27086)

rails guideのRuby on Rails Security Guideの修正です。

deprecatedになっていたSafeERB gem について言及していた箇所があったのを削除しています。


Call fallback exception handlers with the right exception

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

ActiveSupport::Rescuable.rescue_with_handlerメソッドでhandlerが使用するexceptionが誤っていた(handlerが取得出来た際のexceptionを使用するべきところが、最初にrescue_with_handlerの引数に指定されたexceptionを使うようになっていた)のを修正しています。


Merge pull request #26980 from kamipo/respect_new_records_for_collection_proxy_distinct

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

ActiveRecord::CollectionProxy#uniqがデータにnew recordを含んでいた場合に誤った値を返していたのを、new recordが含まれていた場合の正しい値を返すよう修正しています。


Refactor the handling of fallback exception handlers

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

ActiveSupport::Rescuable.rescue_with_handlerメソッドでexceptionは取得出来るがhandlerが取得出来なかった場合の対応を追加しています。


Updated Sprockets Documentation

rails guideのThe Asset Pipelineの修正です。

Making Your Library or Gem a Pre-Processorの項の内容が古いsprocketsに対応した内容になっていたのを、最新のsprocketsに対応した内容に更新しています。


Merge pull request #27070 from jonhyman/patch-raw-true

activesupport/lib/active_support/cache/mem_cache_store.rbの修正です。

MemCacheStore#read_multiメソッドでDalli#get_multiメソッドを呼び出す際に、raw: trueオプションを指定していたのを削除しています。

Dalli#get_multiには取得したいデータのkeyだけを渡す(https://github.com/petergoldstein/dalli/blob/master/lib/dalli/client.rb#L66)必要があり、そこにraw: trueというHashを渡す事により、raw: trueもkeyとして扱われてしまい、無駄なcacheの検索処理が行われてしまっていたため、削除したとの事です。


Merge pull request #26981 from kamipo/should_not_except_order_for_exists

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

exists?メソッドで、limit_valueが指定されている場合はunscope(:order)を行わないよう修正しています。


Merge pull request #26551 from mgpnd/FixContentLength

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

ActionController::TestRequestCONTENT_LENGTH headerに文字数を設定していたのを、バイト数を設定するよう修正しています。

-        set_header "CONTENT_LENGTH", data.length.to_s
-        set_header "rack.input", StringIO.new(data)
+        data_stream = StringIO.new(data)
+        set_header "CONTENT_LENGTH", data_stream.length.to_s
+        set_header "rack.input", data_stream

バイト数が設定されないとJSONへのパース処理等、正確な数字が必要な場合にエラーになってしまう為との事です。


remove Ruby warning from Active Job test helper methods

activejob/lib/active_job/test_helper.rbの修正です。

assert_enqueued_withassert_performed_withメソッドでRubyのwarning(shadowing outer local variable - job)が出ていたので、変数名を変更して対応しています。