lib/acts_as.rb in acts_as-0.3.0 vs lib/acts_as.rb in acts_as-0.3.1
- old
+ new
@@ -54,12 +54,14 @@
def where(opts, *rest)
return self if opts.blank?
relation = super
#TODO support nested attribute joins like Guns.where(rebels: {strength: 10}))
# for now, only first level joins will happen automagically
- detected_associations = opts.keys.map {|attr| acts_as_fields_match(attr) }
- .reject {|attr| attr.nil?}
- return relation.joins(detected_associations) if detected_associations.any?
+ if opts.is_a? Hash
+ detected_associations = opts.keys.map {|attr| acts_as_fields_match(attr) }
+ .reject {|attr| attr.nil?}
+ return relation.joins(detected_associations) if detected_associations.any?
+ end
relation
end
def expand_hash_conditions_for_aggregates(attrs)
attrs = super(attrs)