lib/refinerycms-varnish-pages.rb in refinerycms-varnish-pages-0.0.1 vs lib/refinerycms-varnish-pages.rb in refinerycms-varnish-pages-0.0.2

- old
+ new

@@ -1,16 +1,23 @@ -require 'refinerycms-base' require 'refinerycms-pages' require 'shellac' -class Railtie < Rails::Railtie - - # Enable caching on refinerycms-pages - config.after_initialize do +module Refinery + module VarnishPages + class Engine < Rails::Engine - Admin::PagesController.class_eval do - cache_sweeper :page_sweeper, :only => [:create, :update, :destroy] + config.before_initialize do + require File.expand_path('../refinerycms_varnish/pages_controller_extension', __FILE__) + require File.expand_path('../refinerycms_varnish/page_extension', __FILE__) + end + + refinery.after_inclusion do + ::Admin::PagesController.send :include, RefinerycmsVarnish::PagesControllerExtension + end + + config.to_prepare do + ::Page.send :include, ::RefinerycmsVarnish::PageExtension + end + end - end - end \ No newline at end of file