lib/cached_resource/caching.rb in cached_resource-2.3.0 vs lib/cached_resource/caching.rb in cached_resource-2.3.1
- old
+ new
@@ -62,10 +62,10 @@
def update_collection_cache(updates)
updates = Array(updates)
collection = cache_read(cached_resource.collection_arguments)
if collection && !updates.empty?
- store = RUBY_VERSION.to_f < 1.9 ? ActiveSupport::OrderedHash.new : {}
+ store = CachedResource::Configuration::ORDERED_HASH.new
index = collection.inject(store) { |hash, object| hash[object.send(primary_key)] = object; hash }
updates.each { |object| index[object.send(primary_key)] = object }
cache_write(cached_resource.collection_arguments, index.values)
end
end