cache sweeper is in

Oleg committed Feb 13, 2012
commit 501a1b6972b1d6b448a55302bf25be40d5541b60
Showing 5 changed files with 11 additions and 6 deletions
app/controllers/cms_admin/base_controller.rb +2 -2
@@ @@ -12,8 +12,8 @@ class CmsAdmin::BaseController < ApplicationController
:except => :jump
layout 'cms_admin'
-
- cache_sweeper ComfortableMexicanSofa.config.admin_sweeper.to_s.constantize if ComfortableMexicanSofa.config.admin_sweeper
+
+ cache_sweeper *ComfortableMexicanSofa.config.admin_cache_sweeper
def jump
path = ComfortableMexicanSofa.config.admin_route_redirect
config/initializers/comfortable_mexican_sofa.rb +3 -0
@@ @@ -75,6 +75,9 @@ ComfortableMexicanSofa.configure do |config|
# definition in your database.yml file
# config.database_config = nil
+ # A class that is included as a sweeper to admin base controller if it's set
+ # config.admin_cache_sweeper = nil
+
end
# Default credentials for ComfortableMexicanSofa::HttpAuth
comfortable_mexican_sofa/configuration.rb b/lib/comfortable_mexican_sofa/configuration.rb +4 -4
@@ @@ -7,9 +7,6 @@ class ComfortableMexicanSofa::Configuration
# Module that will handle authentication to access cms-admin area
attr_accessor :admin_auth
-
- # A class that is included as a sweeper to admin base controller if it's set
- attr_accessor :admin_sweeper
# Module that will handle authentication for public pages
attr_accessor :public_auth
@@ @@ -56,11 +53,13 @@ class ComfortableMexicanSofa::Configuration
# in your database.yml file
attr_accessor :database_config
+ # A class that is included as a sweeper to admin base controller if it's set
+ attr_accessor :admin_cache_sweeper
+
# Configuration defaults
def initialize
@cms_title = 'ComfortableMexicanSofa CMS Engine'
@admin_auth = 'ComfortableMexicanSofa::HttpAuth'
- @admin_sweeper = false
@public_auth = 'ComfortableMexicanSofa::DummyAuth'
@seed_data_path = nil
@admin_route_prefix = 'cms-admin'
@@ @@ -79,6 +78,7 @@ class ComfortableMexicanSofa::Configuration
}
@admin_locale = nil
@database_config = nil
+ @admin_cache_sweeper = nil
end
end
test/test_helper.rb +1 -0
@@ @@ -36,6 +36,7 @@ class ActiveSupport::TestCase
}
config.admin_locale = nil
config.upload_file_options = { :url => '/system/:class/:id/:attachment/:style/:filename' }
+ config.admin_cache_sweeper = nil
end
ComfortableMexicanSofa::HttpAuth.username = 'username'
ComfortableMexicanSofa::HttpAuth.password = 'password'
test/unit/configuration_test.rb +1 -0
@@ @@ -27,6 +27,7 @@ class ConfigurationTest < ActiveSupport::TestCase
assert_equal ({
:url => '/system/:class/:id/:attachment/:style/:filename'
}), config.upload_file_options
+ assert_equal nil, config.admin_cache_sweeper
end
def test_initialization_overrides