From be81b5066074fee8126144d072c6132b93d1fe39 Mon Sep 17 00:00:00 2001 From: Maxime Lapointe Date: Fri, 28 Jul 2017 17:53:50 -0400 Subject: Edits following the reviews --- activerecord/lib/active_record/relation/where_clause.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/relation/where_clause.rb b/activerecord/lib/active_record/relation/where_clause.rb index 5b68c25bdd..752bb38481 100644 --- a/activerecord/lib/active_record/relation/where_clause.rb +++ b/activerecord/lib/active_record/relation/where_clause.rb @@ -36,12 +36,14 @@ module ActiveRecord common = self - left right = other - common - return common if left.empty? || right.empty? - - or_clause = WhereClause.new( - [left.ast.or(right.ast)] - ) - common + or_clause + if left.empty? || right.empty? + common + else + or_clause = WhereClause.new( + [left.ast.or(right.ast)], + ) + common + or_clause + end end def to_h(table_name = nil) -- cgit v1.2.3