module ThreeD::ModelFragments::ClassMethods
Public Instance Methods
cache_helper()
click to toggle source
# File lib/three_d/model_fragments.rb, line 43 def cache_helper # TODO: Here should be the real ActionController caching funtionality #ActionController::Caching::Fragments.new end
has_model_fragments?()
click to toggle source
# File lib/three_d/model_fragments.rb, line 39 def has_model_fragments? self.included_modules.include?(InstanceMethods) end
model_fragments()
click to toggle source
# File lib/three_d/model_fragments.rb, line 14 def model_fragments unless has_model_fragments? if ActionController::Base.cache_store.inspect.match("FileStore") self.send :include, InstanceMethods cattr_accessor :caching_path, :allowed_fragments self.caching_path = ActionController::Base.cache_store.cache_path self.after_save :clear_view_cache self.after_destroy :clear_view_cache # TODO: Build hash or array based settings # to allow only specified fragments to get called. # Provide group ability to clear groups of fragments like # :customers => %w(frag_a frag_b frag_c) # user.clear_view_cache_group(:customers) # => frag_a, frag_b frag_c get wiped! self.allowed_fragments = [] else raise "Currently, ModelFragments only support FileStore\nPlease set 'ActionController::Base.cache_store = :file_store, /path/to/cache'" end end end