Skip to content

Commit 60e62d8

Browse files
committed
versions were added.
1 parent 6c48c98 commit 60e62d8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/action_controller/caching/actions.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def caches_action(*actions)
111111
options = actions.extract_options!
112112
options[:layout] = true unless options.key?(:layout)
113113
filter_options = options.extract!(:if, :unless).merge(only: actions)
114-
cache_options = options.extract!(:layout, :cache_path).merge(store_options: options)
114+
cache_options = options.extract!(:layout, :cache_path, :version).merge(store_options: options)
115115

116116
around_action ActionCacheFilter.new(cache_options), filter_options
117117
end
@@ -147,15 +147,18 @@ def expire_action(options = {})
147147

148148
class ActionCacheFilter # :nodoc:
149149
def initialize(options, &block)
150-
@cache_path, @store_options, @cache_layout =
151-
options.values_at(:cache_path, :store_options, :layout)
150+
@cache_path, @store_options, @cache_layout, @version =
151+
options.values_at(:cache_path, :store_options, :layout, :version)
152152
end
153153

154154
def around(controller)
155155
cache_layout = expand_option(controller, @cache_layout)
156156
path_options = expand_option(controller, @cache_path)
157+
version = expand_option(controller, @version)
157158
cache_path = ActionCachePath.new(controller, path_options || {})
158159

160+
@store_options.merge!(version: version)
161+
159162
body = controller.read_fragment(cache_path.path, @store_options)
160163

161164
unless body

0 commit comments

Comments
 (0)