Sha256: 0a629ac7d7060a455aab85fc613c1c88f24a04192d8f5c7c522fc071eaf4d745
Contents?: true
Size: 774 Bytes
Versions: 20
Compression:
Stored size: 774 Bytes
Contents
class Admin::CustomTemplatesController < ApplicationController layout 'admin' require_role 'admin' active_scaffold :custom_template do |config| config.columns = [:name, :template_type, :content] config.action_links.add 'clear_cache', :label => 'Clear Cache' end def clear_cache CustomTemplate.find(:all).each do |template| expire_page(:controller => '/custom_templates', :action => template.template_type, :id => template.name) end render :text => 'Template cache cleared' end protected # Before an updated record, clean out the cache for that page def before_update_save(record) expire_page(:controller => '/custom_templates', :action => record.template_type, :id => record.name) puts "EXPIRED" end end
Version data entries
20 entries across 20 versions & 1 rubygems