From d1729b917f13810a01ec99b9795a4cce8ee9361d Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 3 May 2012 00:54:16 +0100 Subject: actually don't need to expand the aggregates at all --- activerecord/lib/active_record/dynamic_matchers.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'activerecord/lib/active_record/dynamic_matchers.rb') 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 -- cgit v1.2.3