2015/01/20分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Don't mutate bind values in Relation
activerecord/lib/active_record/relation.rb
、
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
where_unscoping
メソッドで処理したbind_values
の値をインスタンス変数に設定するよう修正し、Relation#initialize_copy
でのbind valuesの設定処理を削除しています。
Whether a column exists or not doesn't affect whether we can use binds
activerecord/lib/active_record/relation/query_methods.rb
の修正です、
create_binds
メソッドで行っていたcolumnがnilかどうかの判定処理を削除しています。bind処理において、特にnilかどうかは影響が無い為、との事。
Move create_binds
over to the PredicateBuilder
activerecord/lib/active_record/relation/predicate_builder.rb
、
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
QueryMethods#create_binds
メソッドをPredicateBuilder
配下に移動しています。
Fix bind value copying from subqueried relations
activerecord/lib/active_record/relation/predicate_builder.rb
、
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
build_where
メソッドで行っていたrelationのbind処理をPredicateBuilder#create_binds
内で行うよう修正しています。
元々の処理はattributes
からRelation
objectsを検索し、見つかったらbind valueして、それをmergeしていく、という処理だったのですが、これだとorder
が無視されてしまっていた為、order
が反映されるよう、修正されたようです。
Merge pull request #18597 from kamipo/add-if-exists-to-drop-table
ActiveRecordのConnectionAdaptersの修正です。
drop_table
メソッドにif_exists
オプションを追加しています。
drop_table(:posts, if_exists: true) # => "DROP TABLE IF EXISTS posts" が実行される
存在しないtableに対してdrop_table
を行った際、if_exists: true
の場合何もせず、if_exists: false
の場合、exceptionがraiseされます。デフォルトはfalse
。
tests, use drop_table if_exists: true
in our test suite.
ActiveRecordのテストの修正です。
先に追加されたif_exists
オプションを使ってtableのdropをするよう修正しています。