Permalink
Browse files

Make the aggregate_reflections cache work with strings as its keys.

  • Loading branch information...
1 parent 4c6ba74 commit e7630b62a604a0bc11a56283140f11a80e4cc1b0 @laurocaetano laurocaetano committed Apr 10, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/reflection.rb
@@ -26,7 +26,7 @@ def self.add_reflection(ar, name, reflection)
end
def self.add_aggregate_reflection(ar, name, reflection)
- ar.aggregate_reflections = ar.aggregate_reflections.merge(name => reflection)
+ ar.aggregate_reflections = ar.aggregate_reflections.merge(name.to_s => reflection)
end
# \Reflection enables to interrogate Active Record classes and objects
@@ -48,7 +48,7 @@ def reflect_on_all_aggregations
# Account.reflect_on_aggregation(:balance) # => the balance AggregateReflection
#
def reflect_on_aggregation(aggregation)
- aggregate_reflections[aggregation]
+ aggregate_reflections[aggregation.to_s]
end
# Returns an array of AssociationReflection objects for all the

0 comments on commit e7630b6

Please sign in to comment.