なるようになるブログ

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

rails commit log流し読み(2018/06/30)

2018/06/30分のコミットです。

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


Remove erroneous remove_column option from example

rails guideのActive Record Migrationsの修正です。

remove_columnメソッドのexampleで指定出来ないindexオプションを使用している箇所があったのを削除しています。


Clarify activejob/lib/active_job/test_helper.rb

activejob/lib/active_job/test_helper.rbactivejob/test/cases/test_helper_test.rbの修正です。

assert_enqueued_withメソッドにatオプションを指定した場合のテストを追加、及び、テスト名や変数名をより適切な名前に修正、等を行っています。


Fix Cache :redis_store increment/decrement ttl check and add more tests.

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

RedisCacheStoreincrement / decrementメソッドでttlメソッドの戻り値のチェックに誤りがあったのを修正しています。

             redis.with do |c|
               val = c.incrby key, amount
-              if expires_in > 0 && c.ttl(key) == -2
+              if expires_in > 0 && c.ttl(key) < 0
                 c.expire key, expires_in
               end

ttlメソッドはkeyが存在しないときは-2で、keyが存在する、かつ、有効期限が無い場合は-1を返すようになっており、-1の場合もexpireを呼ぶ必要がある為、上記のように0未満かどうかをチェックするよう修正を行っています。

参考:https://github.com/redis/redis-rb/blob/ddf058bfa03d8cdde492adeb59930dea831466e2/lib/redis.rb#L413-L429


Fix Ruby warnings tickled by the test suite

各テストでRubyのwarningが出ていた箇所があったのをまとめて修正しています。