cache_key_for 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a75d030a404b2048b534fb95b9a34bff92bec378
4
- data.tar.gz: 54d450d3ced6c78baadd1fc9a9c31e4d53bc9ce0
3
+ metadata.gz: 980e594120deb83114f6b9846b81ead0e0fc59a4
4
+ data.tar.gz: e3b7ad9517f78de61c8b23262073b6ce187101f5
5
5
  SHA512:
6
- metadata.gz: 5a7e08df937897ff5aac575f39296b52e7496fed1fecf0b90f810487bd9953513e875e25f92ea338d116540bb90a7eb36723210c2f2c98a9e15ac7e8b2bcf01f
7
- data.tar.gz: 86c4a91d17463bac1c8dc9e809d16e62204618278eb2b23abf0c7433573817e77aafc0e07d50e95e98d06e74e3b80b3b55f2d89a6e75ee81955af5e51be8351f
6
+ metadata.gz: 85e0be361c876f0794afb88f54b37586c67012d6f0ca47408dc5d046e35343a0d07a945595ff9f495774b6662f4e92f282b492cae3cbf71b6211a9b569368720
7
+ data.tar.gz: b4e622b6ce9ed09a875c984c4a09d7ad5f75bc726d953828b7fff772dfb74662337671c17199dd6c36b96e65379a9a8c131efb0e8f5fe17f5cd5ef1fd1ad1a8e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cache_key_for (0.1.10)
4
+ cache_key_for (0.1.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -67,10 +67,15 @@ module CacheKeyForHelper
67
67
  else # Array or not paginated scope
68
68
  scoped_collection.count
69
69
  end
70
- if scoped_collection.respond_to?(:ids)
71
- ids_string = scoped_collection.ids
70
+ ids_string = if scoped_collection.respond_to?(:ids)
71
+ begin
72
+ scoped_collection.ids
73
+ rescue ActiveRecord::EagerLoadPolymorphicError
74
+ Rails.logger.debug "[CacheKeyForHelper] Fallback to array (ActiveRecord::EagerLoadPolymorphicError)"
75
+ scoped_collection.to_a.map(&:id).join('-')
76
+ end
72
77
  else
73
- ids_string = scoped_collection.to_a.map(&:id).join('-')
78
+ scoped_collection.to_a.map(&:id).join('-')
74
79
  end
75
80
  blacklist_params = ['utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_campaign']
76
81
  flat_request_params = if request.params
@@ -87,8 +92,8 @@ module CacheKeyForHelper
87
92
  end
88
93
  digest = Digest::SHA1.hexdigest("#{ids_string}-#{max_updated_at}-#{count}-#{request.subdomains.join('.')}-#{request.path}-#{flat_request_params}")
89
94
  # puts "Caller: #{caller.first}"
90
- puts "generated cache key digest base: #{ids_string}-#{max_updated_at}-#{count}-#{request.subdomains.join('.')}-#{request.path}-#{flat_request_params}"
91
- puts "generated cache key: #{I18n.locale}/#{collection_prefix}/#{digest}/#{cache_owner_cache_key}/#{suffix}"
95
+ # puts "generated cache key digest base: #{ids_string}-#{max_updated_at}-#{count}-#{request.subdomains.join('.')}-#{request.path}-#{flat_request_params}"
96
+ # puts "generated cache key: #{I18n.locale}/#{collection_prefix}/#{digest}/#{cache_owner_cache_key}/#{suffix}"
92
97
  "#{I18n.locale}/#{collection_prefix}/#{digest}/#{cache_owner_cache_key}/#{suffix}"
93
98
  end
94
99
  end
@@ -1,3 +1,3 @@
1
1
  module CacheKeyFor
2
- VERSION = '0.1.10'.freeze
2
+ VERSION = '0.1.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_key_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Kalita