Sha256: b4076c80a7bd15ca331ef6c6e84d7ee624b6becfd1ed40ed3af1566f8f59d3b1
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
class TemplateDependencyException < Exception def initialize(partial, template, dependencies) @partial = partial @template = template @dependencies = dependencies end def message %{#{@partial} not in template cache dependency tree for #{@template}: #{@dependencies.inspect}"} end end class CacheMismatchException < Exception def initialize(template, cache_key) @template = template @cache_key = cache_key end def message %{Cache mismatch: #{@template}, #{@cache_key}} end end ActiveSupport::Notifications.subscribe 'cache_debugging.cache_dependency_missing' do |*args| event = ActiveSupport::Notifications::Event.new(*args) raise TemplateDependencyException.new(event.payload[:partial], event.payload[:template], event.payload[:dependencies]) end ActiveSupport::Notifications.subscribe 'cache_debugging.cache_mismatch' do |*args| event = ActiveSupport::Notifications::Event.new(*args) raise CacheMismatchException.new(event.payload[:template], event.payload[:cache_key]) end
Version data entries
3 entries across 3 versions & 1 rubygems