2015/01/26分のコミットです。
CHANGELOGへの追加はありませんでした。
Fix a typo "devleopment" => "development"
activerecord/lib/active_record/attribute_methods.rb
のdocの修正です。
devleopment
-> development
にタイポを修正しています。
Fix typo 'another frameworks' => 'other frameworks'
railties/lib/rails/generators/migration.rb
のdocの修正です
another frameworks
-> other frameworks
にタイポを修正しています。
railties/lib/rails/generators/migration.rb
のdocの修正です。
migrations has
-> migrations have
にタイポを修正しています。
Don't rely as much on the structure of the values hash in associations
activerecord/lib/active_record/associations/preloader.rb
、
activerecord/lib/active_record/associations/preloader/association.rb
の修正です。
associationのwhere valueの取得処理をvalues hashから取得しないよう修正しています。
values[:where]
の構造を変更する予定で、values[:where]
から直接値を取得しないよう修正中との事です。
Don't access the where values hash directly in through associations
activerecord/lib/active_record/associations/preloader/through_association.rb
の修正です。
先のコミット同様、values hashから値を取得する処理を修正しています。
Introduce Relation::WhereClause
activerecord/lib/active_record/relation/query_methods.rb
、
activerecord/lib/active_record/relation/where_clause.rb
の修正です。
現状、bind valuesに関する処理がちらかってしまっていて、それを整理する為のリファクタリングとして、手始めに
where
メソッドのbind処理をまとめたRelation::WhereClause
クラスを作成しています。おって、`JoinClause``クラスも作成予定との事。
以降WhereClause
クラスを使用するリファクタリングのコミットが続きます。
Move where merging logic over to WhereClause
activerecord/lib/active_record/relation/merger.rb
、
activerecord/lib/active_record/relation/where_clause.rb
の取得です。
Merger
クラスにあったwhereのマージロジックをWhereClause
クラスに移動しています。
Remove references to :bind
in except
activerecord/lib/active_record/associations/association_scope.rb
、
activerecord/lib/active_record/relation/spawn_methods.rb
の修正です。
except
メソッドから:bind
引数を削除しています。
Remove all references to where_values
in association code
ActiveRecordの修正です。
where_values
を使用している箇所をwhere_clause
を使用する修正しています。
Move the construction of WhereClause
objects out of Relation
activerecord/lib/active_record/relation/query_methods.rb
、
activerecord/lib/active_record/relation/where_clause_factory.rb
の修正です。
WhereClauseFactory
クラスを新規に作成し、WhereClause
の作成処理をそちらのクラスに移動しています。
Move where.not
logic into WhereClause
activerecord/lib/active_record/relation/query_methods.rb
、
activerecord/lib/active_record/relation/where_clause.rb
の修正です。
where.not
の実装をWhereClause
クラスに移動しています。
Rename WhereClause#parts
to WhereClause#predicates
activerecord/lib/active_record/relation/where_clause.rb
の修正です。
WhereClause#parts
メソッドをWhereClause#predicates
メソッドに名前を変更しています。
Relation#Merger
can merge all clause methods
https://github.com/rails/rails/commit/b6a9c620aa58ac0b60ec3b18c380d296c0ec408d
activerecord/lib/active_record/relation/merger.rb
の修正です。
Relation::Merger#merge_clauses
メソッドを追加し、where以外のclauseメソッドもマージ出来るよう修正しています。
実装はこんな感じです。
def merge_clauses CLAUSE_METHODS.each do |name| clause = relation.send("#{name}_clause") other_clause = other.send("#{name}_clause") relation.send("#{name}_clause=", clause.merge(other_clause)) end end
Remove most references to where_values
in QueryMethods
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
where_values
を使用している箇所をwhere_clause
を使用する修正しています。
Move where_unscoping
logic over to WhereClause
activerecord/lib/active_record/relation/query_methods.rb
、
activerecord/lib/active_record/relation/where_clause.rb
の修正です。
where_unscoping
メソッドの実装をWhereClause
クラスに移動しています。
Remove all references to where_values
in tests
ActiveRecordのテストの修正です。
where_values
を使用している箇所をwhere_clause
を使用する修正しています。
Move where_values_hash
over to WhereClause
activerecord/lib/active_record/relation.rb
、
activerecord/lib/active_record/relation/where_clause.rb
の修正です。
where_values_hash
の実装をWhereClause
クラスに移動しています。
Correct the implementation for unscope(:where)
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
unscope(:where)
の実装で、single-value メソッドで無い場合にmulti-valueメソッドとして処理を扱う、という実装があったのを
multi valueメソッドかどうかで、処理を行うよう修正しています。
MULTI_VALUE_METHODS = [:includes, :eager_load, :preload, :select, :group, :order, :joins, :having, :references, :extending, :unscope] SINGLE_VALUE_METHODS = [:limit, :offset, :lock, :readonly, :from, :reordering, :reverse_order, :distinct, :create_with, :uniq]
こんな感じに、single-value/ multi-valueのメソッドの一覧が定数で管理されているようです。
Remove where_values
and where_values=
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
where_clause
、where_values=
メソッドを削除しています。
Move method to private section
activerecord/lib/active_record/attribute_assignment.rb
の修正です。
_assign_attributes
メソッドをprivateに移動しています。ActiveModelと合わせる為との事。