なるようになるブログ

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

rails commit log流し読み(2017/03/15)

2017/03/15分のコミットです。

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

activesupport/CHANGELOG.md


Add CHANGELOG entry for –skip-coffee [ci skip]

railties/CHANGELOG.mdの修正です。

rails newコマンドに--skip-coffeeオプションを追加した対応について、エントリーを追加しています。


Don’t cast to float unnecessarily

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

deliveryのテストでTimeインスタンス同士を足す際に、Timeをfloatに変換してから加算処理を行っていたのを、Timeインスタンスのまま加算処理を行うよう修正しています。


Rename test of app:update to more appropriate name

railties/test/generators/app_generator_test.rbの修正です。

app:updateタスクに関するテストのテスト名がxxx_rails_update_xxxになっていたのを、タスク名に合わせてxxx_app_update_xxxに修正しています。


Remove unused @txn variable

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

ActiveRecord::Core moduleから使用していいない@txn変数を削除しています。


Merge pull request #28409 from y-yagi/make_destroy_command_work_within_engines

railties/lib/rails/commands/destroy/destroy_command.rbの修正です。

rails destroyコマンドがrails engineで動作しないバグがあったのを修正しています。


Remove implicit coercion deprecation of durations

Active Supportの修正です。

Merge pull request #28204 from rails/deprecate-implicit-coercion-of-durationsでdeprecateになった、NumericからActiveSupport::Durationへの暗黙的な変換処理が、deprecateではなくなりました。

サードパーティのライブラリの設定をする際に、この暗黙的な変換処理に依存している処理があった(e.g. redis.expire("foo", 5.minutes))為、deprecateにするのはやめたとの事です。

代わりに、numericをラップしたprivateクラスを追加し、そこで処理を行う事でdurationの情報を維持したまま処理が行えるようにしています。

# before
Date.today + 2 * 1.day
# => Tue, 25 Apr 2490

# after
Date.today + 2 * 1.day
# => Sat, 18 Mar 2017 00:00:00 UTC +00:00

Use better duration aliases in tests

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

deliveryのテストで10分waitさせたい場合の値が600.secondsになっていたのを10.minutesに修正しています。


Restore 5.minutes changed in #28204

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

write_entryメソッドでexpireの値を追加する時にActiveSupport::Durationクラスの値をそのまま使用するよう修正しています。