From d26dd00854c783bcb1249168bb3f4adf9f99be6c Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 27 Jan 2015 10:30:38 -0700 Subject: `WhereClause#predicates` does not need to be public The only place it was accessed was in tests. Many of them have another way that they can test their behavior, that doesn't involve reaching into internals as far as they did. `AssociationScopeTest` is testing a situation where the where clause would have one bind param per predicate, so it can just ignore the predicates entirely. The where chain test was primarly duplicating the logic tested on `WhereClause` directly, so I instead just make sure it calls the appropriate method which is fully tested in isolation. --- activerecord/lib/active_record/relation/where_clause.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 6c62332609..1a70dc447e 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation class WhereClause # :nodoc: - attr_reader :predicates, :binds + attr_reader :binds delegate :any?, :empty?, to: :predicates @@ -73,6 +73,8 @@ module ActiveRecord protected + attr_reader :predicates + def referenced_columns @referenced_columns ||= begin equality_nodes = predicates.select { |n| equality_node?(n) } -- cgit v1.2.3