Sha256: dc6eeca7351b04db1d1ce9b65bcae76b21130a1bdd53162b5490269913c5cb6e

Contents?: true

Size: 935 Bytes

Versions: 8

Compression:

Stored size: 935 Bytes

Contents

# Features:
# * all features of `cache_key_for` method
# * better debugging (accepts view/partial file path for visible part of cache key)

# Example (haml):

# ```haml
#     - cache cache_key_for_view(__FILE__, @service.datacenters, 'datacenters', current_company.cache_key, Time.now.utc.to_date.to_s) do
# ```

# Rails will generate cache at:

# ```
# app_name:views/en/datacenters/5bd92bd352e7726d02175752913014711f5d412e/companies/1-20150619101645935901000/2015-06-
# 26/app/views/services/datacenters.html.haml/4324f99340fd2b2bc7e26b8e9b79d8f5
# ```
module CacheKeyForViewHelper
  include CacheKeyForHelper
  def cache_key_for_view(file, scoped_collection, collection_prefix, cache_owner_cache_key = '', suffix = '', whitelist_params = [], default_params = {})
    "#{cache_key_for(scoped_collection, collection_prefix, cache_owner_cache_key, suffix, whitelist_params, default_params)}#{file.gsub(Rails.root.to_s, '')}"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cache_key_for-0.1.11 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.10 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.9 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.8 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.7 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.6 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.5 lib/cache_key_for/cache_key_for_view_helper.rb
cache_key_for-0.1.4 lib/cache_key_for/cache_key_for_view_helper.rb