なるようになるブログ

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

rails commit log流し読み(2014/11/02)

2014/11/02分のコミットです。

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

activerecord/CHANGELOG.md


add missing space.[ci skip]

activemodel/lib/active_model/validations/format.rbのdocの修正です。

doc内にスペースが足りてなかったのを追加しています。


Tiny documentation fixes and styling improvements

activejob/lib/active_job/test_helper.rbguides/source/active_job_basics.mdの修正です。

グラマーの修正、generatorの出力内容に不足があったのを追加、テストクラスの内容に誤りがあったの等を修正しています。


Remove redundant require of file

activemodel/test/cases/validations/validates_test.rbの修正です。

不要なrequire処理を削除しています。


Don't needlessly alphabetize columns for insert/update

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

insert/update処理を行う際、カラム名をアルファベット順にソートしていたのですが、必要無いからという事で、その処理を削除しています。


Use bind values for joined tables in where statements

ActiveRecordの修正です。

joinしたtableの値をwhere statementに指定出来るよう対応しています。

class Author < ActiveRecord::Base
  has_many :serialized_posts
end

class SerializedPost < ActiveRecord::Base
  serialize :title
end
Author.joins(:serialized_posts).where(name: "David", serialized_posts: { title: "Hello" }).length

これは便利そうですねえ。


Fix test which failed in isolation

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

不足していたmodels/vertexのrequireを追加しています。


[ci skip] Relation#bind is not public API

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

bindメソッド:nodoc:を追加しています。


Add link to API Documentation Guidelines

rails guideのRuby on Rails Guides Guidelinesの修正です。

API Documentation Guidelineへのリンクが不足していたのを追加しています。


Correctly cast calculation results on PG

ActiveRecordの修正です。

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

calc系の処理を行った際、適切な結果の表示を行えるよう、変換処理を追加しています。

def column_name_for_operation(operation, node) # :nodoc:
  OPERATION_ALIASES.fetch(operation) { operation.downcase }
end

OPERATION_ALIASES = { # :nodoc:
  "maximum" => "max",
  "minimum" => "min",
  "average" => "avg",
}

Call gsub with a Regexp instead of a String for better performance

gsubメソッドの第一引数にStringを指定していたのをRegexpに修正しています。 Regexpの方が早いからですね。


Add a test case for range type casting

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

range typeのcast処理についてのテストを追加しています。


Don't duplicate predicate building logic in Relation finders

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

重複しているpredicateの生成処理を削除しています。


Merge pull request #17469 from rishijain/update_docs_2

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

ActionJob::QueueAdapter module について、docを追加しています。