Skip to content

Commit

Permalink
Remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
christophermanning committed Dec 12, 2012
1 parent ba235e8 commit 19100e4
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/multi_fetch_fragments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ def render_collection_with_multi_fetch_cache

keys_to_collection_map = {}

@collection.each do |item|
@collection.each do |item|
key = @options[:cache].is_a?(Proc) ? @options[:cache].call(item) : item
expanded_key = ActiveSupport::Cache.expand_cache_key(key)
keys_to_collection_map[expanded_key] = item
keys_to_collection_map[expanded_key] = item
end

collection_to_keys_map = keys_to_collection_map.invert

result_hash = Rails.cache.read_multi(keys_to_collection_map.keys)

# if we had a cached value, we don't need to render that object from the collection.
Expand All @@ -43,10 +41,6 @@ def render_collection_with_multi_fetch_cache

# sequentially render any non-cached objects remaining
if @collection.any?

#store these to use later for sorting the results
collection_objects_clone = @collection.clone

non_cached_results = @template ? collection_with_template : collection_without_template
end

Expand All @@ -67,7 +61,7 @@ def render_collection_with_multi_fetch_cache
else
results = @template ? collection_with_template : collection_without_template
end

results.join(spacer).html_safe
end

Expand All @@ -78,4 +72,4 @@ class Railtie < Rails::Railtie
end
end
end
end
end

0 comments on commit 19100e4

Please sign in to comment.