aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-12-29 00:07:46 +0530
committerPratik Naik <pratiknaik@gmail.com>2009-12-29 00:07:46 +0530
commit91e28aae8649c503e81d66ad6829403ccc2c6571 (patch)
treeed51b3519723cc1966e1faa31d0a2478f8b2c0e0 /activerecord/lib/active_record/associations.rb
parente8ca22d129c1e93574e770dd69dc964be6686469 (diff)
downloadrails-91e28aae8649c503e81d66ad6829403ccc2c6571.tar.gz
rails-91e28aae8649c503e81d66ad6829403ccc2c6571.tar.bz2
rails-91e28aae8649c503e81d66ad6829403ccc2c6571.zip
Add Model.having and Relation#having
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index c23c9f63f1..7242ebf387 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1715,7 +1715,8 @@ module ActiveRecord
relation = relation.joins(construct_join(options[:joins], scope)).
select(column_aliases(join_dependency)).
- group(construct_group(options[:group], options[:having], scope)).
+ group(options[:group] || (scope && scope[:group])).
+ having(options[:having] || (scope && scope[:having])).
order(construct_order(options[:order], scope)).
where(construct_conditions(options[:conditions], scope)).
from((scope && scope[:from]) || options[:from])
@@ -1759,7 +1760,8 @@ module ActiveRecord
relation = relation.joins(construct_join(options[:joins], scope)).
where(construct_conditions(options[:conditions], scope)).
- group(construct_group(options[:group], options[:having], scope)).
+ group(options[:group] || (scope && scope[:group])).
+ having(options[:having] || (scope && scope[:having])).
order(construct_order(options[:order], scope)).
limit(construct_limit(options[:limit], scope)).
offset(construct_limit(options[:offset], scope)).