From 3db876cb761837ebf9b02d22846353e277ff14cd Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 3 Jan 2010 20:50:04 +0530 Subject: Relation#merge and Relation#except should respect havings --- activerecord/lib/active_record/relation/spawn_methods.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index b9e3457aac..ea58812faa 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -23,7 +23,8 @@ module ActiveRecord 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 @@ module ActiveRecord 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 -- cgit v1.2.3