@@ -111,7 +111,7 @@ def caches_action(*actions)
111
111
options = actions . extract_options!
112
112
options [ :layout ] = true unless options . key? ( :layout )
113
113
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 )
115
115
116
116
around_action ActionCacheFilter . new ( cache_options ) , filter_options
117
117
end
@@ -147,15 +147,18 @@ def expire_action(options = {})
147
147
148
148
class ActionCacheFilter # :nodoc:
149
149
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 )
152
152
end
153
153
154
154
def around ( controller )
155
155
cache_layout = expand_option ( controller , @cache_layout )
156
156
path_options = expand_option ( controller , @cache_path )
157
+ version = expand_option ( controller , @version )
157
158
cache_path = ActionCachePath . new ( controller , path_options || { } )
158
159
160
+ @store_options . merge! ( version : version )
161
+
159
162
body = controller . read_fragment ( cache_path . path , @store_options )
160
163
161
164
unless body
0 commit comments