2014/10/14分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
add length to ActiveRecord::Result https://github.com/rails/rails/commit/f0c2c6469f142e826ac2c60673bba2d18d7df6e6
activerecord/lib/active_record/result.rb
の修正です。
ActiveRecord::Result
にlength
メソッドを追加しています。
ActiveRecord::Base.connection.exec_query('SELECT id FROM todos').length # => 2
Don't need to account turbolinks cookies in get request.
railties/test/application/middleware/cache_test.rb
の修正です。
"X-Rack-Cache"
の値のチェックをするテストから、request_method の値を削除しています。
元々はcookiesにrequest_method
の値を設定していたのですが、GETリクエストの場合、request_method
を削除するようturbolinksが修正しており、その影響でテストを修正したようです。
Gemfile
の修正です。
turbolinksのバージョン指定を削除しています。
measure record instantiation time in AS::Notifications
activerecord/lib/active_record/associations/join_dependency.rb
、
activerecord/lib/active_record/querying.rb
の修正です。
ActiveRecordのインスタンスを生成する際に、生成するクラス、生成数、所要時間をActiveSupport::Notifications
で記録するよう対応しています。
notifications = [] ActiveSupport::Notifications.subscribe('instantiation.active_record') do |*args| notifications << args end Todo.all p notifications # => [["instantiation.active_record", 2014-10-14 18:07:00 +0900, 2014-10-14 18:07:00 +0900, "7c97974bb2e64ece450a", {:record_count=>2, :class_name=>"Todo"}]]
性能測定に便利そうですねえ。
Remove duplicate error message "Couldn't find..."
activerecord/lib/active_record/relation/finder_methods.rb
の修正です。
first!
、second!
等の特定の値を取得するメソッドで、同一のエラーメッセージがそれぞれのメソッドで定義されてしまっていたので、共通メソッドに切り出しています。
Clarify #update_all
doc about value processing
activerecord/lib/active_record/relation.rb
のdocの修正です。
update_all
について、ActiveRecord's type-castingは行われない旨説明を追加しています。
class User < ActiveRecord::Base enum status: %w(unapproved approved) end User.unapproved.update_all(status: 'approved')
上記の例の場合、update_all
で生成されるSQLは
UPDATE "users" SET "status" = 1 WHERE "users"."status" = 0
ではなく、
UPDATE "users" SET "status" = 0 WHERE "users"."status" = 0
になります。
update_all
はlow level APIの為との事です。
Add #key? to ActiveModel::Errors
activemodel/lib/active_model/errors.rb
の修正です。
ActiveModel::Errors
にkey?
メソッドを追加しています。
errors = ActiveModel::Errors.new(self) errors[:foo] = 'omg' assert_equal true, errors.key?(:foo), 'errors should have key :foo'
Improve Journey compliance to RFC 3986
actionpack/lib/action_dispatch/journey/scanner.rb
の修正です。
RFC 3986のsub-delims sectionに定義されている記号をrouterに使用出来るよう、修正しています。
例
# config/routes.rb get '/boom!', to: 'boom#bang', as: :boom_bang # app/controllers/boom_controller.rb class BoomController < ApplicationController def bang; render text: 'bang!'; end end
元々はエクスクラメーション・マーク付きURLは使用出来なかったんですね。
因みに、sub-delimに定義されている記号は以下の通りです。
"!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="