Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Relation#merge and Relation#except should respect havings

  • Loading branch information...
commit 3db876cb761837ebf9b02d22846353e277ff14cd 1 parent af5e1b4
@lifo lifo authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 activerecord/lib/active_record/relation/spawn_methods.rb
View
4 activerecord/lib/active_record/relation/spawn_methods.rb
@@ -23,7 +23,8 @@ def merge(r)
limit(arel.taken).
offset(arel.skipped).
select(arel.send(:select_clauses)).
- from(arel.sources)
+ from(arel.sources).
+ having(arel.havings)
end
relation_order = r.send(:order_clause)
@@ -63,6 +64,7 @@ def except(*skips)
result = result.from(@relation.sources) unless skips.include?(:from)
result = result.order(order_clause) unless skips.include?(:order)
result = result.where(*@relation.wheres) unless skips.include?(:where)
+ result = result.having(*@relation.havings) unless skips.include?(:having)
result
end
Please sign in to comment.
Something went wrong with that request. Please try again.