multi_fetch_fragments 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/multi_fetch_fragments.rb +5 -5
  2. metadata +1 -1
@@ -33,9 +33,9 @@ module MultiFetchFragments
33
33
  # if we had a cached value, we don't need to render that object from the collection.
34
34
  # if it wasn't cached, we need to render those objects as before
35
35
  result_hash.each do |key, value|
36
- if value.present?
37
- collections_object = keys_to_collection_map[key]
38
- @collection.delete(collections_object)
36
+ if value
37
+ collection_item = keys_to_collection_map[key]
38
+ @collection.delete(collection_item)
39
39
  end
40
40
  end
41
41
 
@@ -44,6 +44,7 @@ module MultiFetchFragments
44
44
  # sequentially render any non-cached objects remaining
45
45
  if @collection.any?
46
46
 
47
+ #store these to use later for sorting the results
47
48
  collection_objects_clone = @collection.clone
48
49
 
49
50
  non_cached_results = @template ? collection_with_template : collection_without_template
@@ -52,10 +53,9 @@ module MultiFetchFragments
52
53
  # sort the result according to the keys that were fed in, cache the non-cached results
53
54
  keys_to_collection_map.each do |key, value|
54
55
 
55
- # was it in the cache?
56
56
  cached_value = result_hash[key]
57
57
  if cached_value
58
- results << result_hash[key]
58
+ results << cached_value
59
59
  else
60
60
  non_cached_result = non_cached_results.shift
61
61
  Rails.cache.write(key, non_cached_result)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_fetch_fragments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: