aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-05-03 00:54:16 +0100
committerJon Leighton <j@jonathanleighton.com>2012-05-04 12:50:07 +0100
commitd1729b917f13810a01ec99b9795a4cce8ee9361d (patch)
treef3d6c6e8364311d5e98fcede2ac5139239a5ef6a /activerecord
parent780e8939c0f76399c76b13539f1ffe2d0940d941 (diff)
downloadrails-d1729b917f13810a01ec99b9795a4cce8ee9361d.tar.gz
rails-d1729b917f13810a01ec99b9795a4cce8ee9361d.tar.bz2
rails-d1729b917f13810a01ec99b9795a4cce8ee9361d.zip
actually don't need to expand the aggregates at all
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/dynamic_matchers.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb
index 1a057ea25e..8726442d0b 100644
--- a/activerecord/lib/active_record/dynamic_matchers.rb
+++ b/activerecord/lib/active_record/dynamic_matchers.rb
@@ -60,18 +60,8 @@ module ActiveRecord
@attribute_names = @name.match(self.class.pattern)[1].split('_and_')
end
- def expand_attribute_names_for_aggregates
- attribute_names.map do |attribute_name|
- if aggregation = model.reflect_on_aggregation(attribute_name.to_sym)
- aggregation.mapping.map(&:first)
- else
- attribute_name
- end
- end.flatten
- end
-
def valid?
- (expand_attribute_names_for_aggregates - model.column_names).empty?
+ attribute_names.all? { |name| model.columns_hash[name] || model.reflect_on_aggregation(name.to_sym) }
end
def define