aub-cache_advance 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/cache_advance.gemspec +1 -1
- data/rails/init.rb +13 -4
- metadata +1 -1
data/cache_advance.gemspec
CHANGED
data/rails/init.rb
CHANGED
@@ -10,10 +10,19 @@ require 'config/caches'
|
|
10
10
|
require 'dispatcher'
|
11
11
|
|
12
12
|
# This is the helper method that can be used in rails views/controllers/helpers.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# If caching is disabled, just make it yield the results of the block.
|
14
|
+
if config.action_controller.perform_caching
|
15
|
+
ActionController::Base.helper do
|
16
|
+
def cache_it(cache, options={}, &block)
|
17
|
+
CacheAdvance::Caches.apply(cache, request, options) do
|
18
|
+
capture(&block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
ActionController::Base.helper do
|
24
|
+
def cache_it(cache, options={})
|
25
|
+
yield
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|