なるようになるブログ

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

rails commit log流し読み(2017/07/27)

2017/07/27分のコミットです。

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

activesupport/CHANGELOG.md


Fix search input’s type & placeholder conflict in Routing Error page

actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erbの修正です。

Routing Error Pageの検索用inputに-webkit-appearance: textfield;を指定しています。

ブラウザがデフォルトで設定するplaceholderとhtmlで設定しているplaceholderがコンフリクトしてしまっていた為、ブラウザ側のplaceholderを表示しないようにする為設定したようです。

before

28632623-ec89dfd8-7239-11e7-8b88-e4e321fdb3e1.png (661×830)

after

28632633-f01b898a-7239-11e7-9dc6-664a7d39c896.png (660×831)


Use _relation_for_itself wherever possible

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

自身のrelationを取得する処理を独自に行っていたのを、_relation_for_itselfメソッドを使用するよう修正しています。_relation_for_itselfメソッドはその為のメソッドの為。


Merge pull request #28695 from koic/integer_type_has_precision_option_in_oracle

activerecord/test/cases/comment_test.rbの修正です。

schema dumpにcommentが含まれる事を確認するテストがOracle adapterでコケてしまっていたのを修正しています。

+      if current_adapter?(:OracleAdapter)
+        assert_match %r[t\.integer\s+"rating",\s+precision: 38,\s+comment: "I am running out of imagination"], output
+      else
+        assert_match %r[t\.integer\s+"rating",\s+comment: "I am running out of imagination"], output
+      end

Oracle adapterの場合、precisionの指定が無くてもdumpにprecisionが出力されてしまうからのようです。


Fix division where a duration is the denominator

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

Fix implicit calculations with scalars and durationsの影響で、分母にDurationを使用した除算の結果がおかしくなってしまっていたのを修正しています。

# before
86400 / 1.hour
# => 86400 hours

1.day / 1.hour
# => 0 days


# after
86400 / 1.hour
# => 24

1.day / 1.hour
# => 24

5.1.1までと同じように、Integerの結果がかえるようになっています。