Skip to content
Browse files

actually don't need to expand the aggregates at all

  • Loading branch information...
1 parent 780e893 commit d1729b917f13810a01ec99b9795a4cce8ee9361d @jonleighton jonleighton committed May 3, 2012
Showing with 1 addition and 11 deletions.
  1. +1 −11 activerecord/lib/active_record/dynamic_matchers.rb
View
12 activerecord/lib/active_record/dynamic_matchers.rb
@@ -60,18 +60,8 @@ def initialize(model, name)
@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

0 comments on commit d1729b9

Please sign in to comment.
Something went wrong with that request. Please try again.