なるようになるブログ

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

rails commit log流し読み(2014/05/12)

2014/05/12分のコミットです。

PostgreSQLのDB Adapterの修正が多かった日でした。

PKにbigserialが指定出来ないバグ、Infinity/NaNを正しく扱う為の修正等行われています。


Tidy up implementation of #15010

ActiveSupport::TimeZone#parseメソッドの修正です。

昨日行われた月のデフォルトの値の修正について、リファクタリングしています。


Replace :base with :in [ci skip]

railties/lib/rails/generators/base.rbのdocの修正です。

オプションを:base -> :inに修正しています。docの修正漏れ対応です。


Merge pull request #10662 from take/change-test-name-for-ActiveRecord--Validations#valid-

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

テストメソッド名の修正及び、saveメソッドで結果の確認をしている箇所をvalid?メソッドに修正しています。


Remove redundant tests method.

actionpack/test/controller/send_file_test.rbの修正です。

不要なtestsメソッドを削除しています。


correcting method documentation [ci skip]

ActiveRecord::AttributeMethods#attribute_present?のdocの修正です。

person = Task.new(title: '', is_done: false)となっていた箇所をtask = Task.new(title: '', is_done: false)に修正しています。

変数名をクラス名に合わせています。


Update attribute_methods.rb

こちらもActiveRecord::AttributeMethods#attribute_present?のdocの修正です。

-    #   task.title = 'Francesco'
+    #   task.title = 'Buy milk'

これは、何の為の修正だろう…。


Modify assert conditions not to be affected

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

to_sqlメソッドのテストを修正しています。


Handle other pk types in PostgreSQL gracefully.

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbの修正です。

PKにbigserial型を指定出来なかったバグを修正しています。


pg, fix Infinity and NaN values conversion.

PostgreSQLAdapter::OID::Float#type_castメソッドの修正です。

DBの値がInfinity/-Infinity/NaNだった場合に、それぞれFloat::INFINITYFloat::NANを返すように修正しています。

# before
  Point.create(value: 1.0/0)
  Point.last.value # => 0.0

# after
  Point.create(value: 1.0/0)
  Point.last.value # => Infinity

Infinityが入るケースって、どんな使い方している時なんだろう。


pg, map char and name types as string. [dark-panda & Yves Senn]

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb及びテストの修正です。

PostgreSQLは特別な文字型として、"char"nameという名前の型があるので、その型を適切に扱えるよう修正しています。

PostgreSQLのdocはこちらnameは知らなかったです。