Module: Sparkle::Helper

Defined in:
lib/sparkle/helper.rb

Instance Method Summary collapse

Instance Method Details

#render_sparkle(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/sparkle/helper.rb', line 4

def render_sparkle options
  key = rand(2**128).to_s(36)
  Rails.cache.write(key, options)
  if options[:locals].values.any? { |value| value._sparkle_cached_ if value.class.include?(Refreshable) }
    options[:locals][:sparkle_cache_key] = key
  else
    options[:locals][:sparkle_cache_key] = nil
  end
  render options
end