diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-25 17:09:14 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-25 17:09:14 -0700 |
commit | 924127e21f13cadb6299a37df5bcd62a3b979ce7 (patch) | |
tree | 034a1e3e21139d36e7b95ab60809aac82d18e2f7 /activerecord/lib | |
parent | 2ae49dd073a8037ef7ea69e7b1f5507ff514a051 (diff) | |
download | rails-924127e21f13cadb6299a37df5bcd62a3b979ce7.tar.gz rails-924127e21f13cadb6299a37df5bcd62a3b979ce7.tar.bz2 rails-924127e21f13cadb6299a37df5bcd62a3b979ce7.zip |
Rename `WhereClause#parts` to `WhereClause#predicates`
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/where_clause.rb | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d2473188cb..e277282ecd 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -93,7 +93,7 @@ module ActiveRecord end def where_values - where_clause.parts + where_clause.predicates end def where_values=(values) @@ -105,7 +105,7 @@ module ActiveRecord end def bind_values=(values) - self.where_clause = Relation::WhereClause.new(where_clause.parts, values || []) + self.where_clause = Relation::WhereClause.new(where_clause.predicates, values || []) end def create_with_value # :nodoc: @@ -959,7 +959,7 @@ module ActiveRecord def build_where(opts, other = []) where_clause = where_clause_factory.build(opts, other) self.bind_values += where_clause.binds - where_clause.parts + where_clause.predicates end def association_for_table(table_name) diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 676b0d47d3..f03f95df0b 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -1,37 +1,37 @@ module ActiveRecord class Relation class WhereClause # :nodoc: - attr_reader :parts, :binds + attr_reader :predicates, :binds - delegate :empty?, to: :parts + delegate :empty?, to: :predicates - def initialize(parts, binds) - @parts = parts + def initialize(predicates, binds) + @predicates = predicates @binds = binds end def +(other) WhereClause.new( - parts + other.parts, + predicates + other.predicates, binds + other.binds, ) end def merge(other) WhereClause.new( - parts_unreferenced_by(other) + other.parts, + predicates_unreferenced_by(other) + other.predicates, non_conflicting_binds(other) + other.binds, ) end def ==(other) other.is_a?(WhereClause) && - parts == other.parts && + predicates == other.predicates && binds == other.binds end def invert - WhereClause.new(inverted_parts, binds) + WhereClause.new(inverted_predicates, binds) end def self.empty @@ -42,15 +42,15 @@ module ActiveRecord def referenced_columns @referenced_columns ||= begin - equality_nodes = parts.select { |n| equality_node?(n) } + equality_nodes = predicates.select { |n| equality_node?(n) } Set.new(equality_nodes, &:left) end end private - def parts_unreferenced_by(other) - parts.reject do |n| + def predicates_unreferenced_by(other) + predicates.reject do |n| equality_node?(n) && other.referenced_columns.include?(n.left) end end @@ -65,8 +65,8 @@ module ActiveRecord binds.reject { |col, _| conflicts.include?(col.name) } end - def inverted_parts - parts.map { |node| invert_predicate(node) } + def inverted_predicates + predicates.map { |node| invert_predicate(node) } end def invert_predicate(node) |