lib/nitro/caching.rb in nitro-0.19.0 vs lib/nitro/caching.rb in nitro-0.20.0

- old
+ new

@@ -7,30 +7,35 @@ require 'nitro/caching/fragments' module Nitro # Adds support for caching. +#-- +# TODO: add per controller caching_enabled. +#++ module Caching # Globaly enable/disable caching. - mattr_accessor :caching_enabled, true + setting :caching_enabled, :default => true, :doc => 'Globaly enable/disable caching' def self.append_features(base) #:nodoc: super base.send :include, Output, Actions, Fragments - base.class_eval do - cattr_accessor :caching_enabled, true + base.module_eval do +# @caching_enabled = true + def self.caching_enabled? + Caching.caching_enabled # and @caching_enabled + end + + private + + def caching_enabled? + Caching.caching_enabled # and self.class.get_instance_variable(:caching_enabled) + end end end - -private - - def caching_enabled? - Caching.caching_enabled and self.class.caching_enabled - end - end end # * George Moschovitis <gm@navel.gr>