Module: CacheDebugging::StrictDependencies

Extended by:
ActiveSupport::Concern
Defined in:
lib/cache_debugging/strict_dependencies.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.strict_dependencies_enabled?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/cache_debugging/strict_dependencies.rb', line 5

def self.strict_dependencies_enabled?
  !!Rails.application.config.cache_debugging.strict_dependencies
end

Instance Method Details

#render_with_template_dependencies(*args, &block) ⇒ Object

every time we render, we want to check if the partial is in the dependency list



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cache_debugging/strict_dependencies.rb', line 14

def render_with_template_dependencies(*args, &block)
  if CacheDebugging::StrictDependencies.strict_dependencies_enabled? && cache_blocks.length > 0
    options = args.first
    if options.is_a?(Hash)
      if partial = options[:partial]
        validate_partial!(partial)
      end
    else
      (options.respond_to?(:to_ary) ? options.to_ary : Array(options)).each do |object|
        validate_partial!(Utils.object_partial_path(object))
      end
    end
  end
  render_without_template_dependencies(*args, &block)
end