@@ -35,6 +35,7 @@ class ActionCachingTestController < CachingController
35
35
caches_action :show , cache_path : 'http://test.host/custom/show'
36
36
caches_action :edit , cache_path : Proc . new { |c | c . params [ :id ] ? "http://test.host/#{ c . params [ :id ] } ;edit" : 'http://test.host/edit' }
37
37
caches_action :custom_cache_path , cache_path : CachePath . new
38
+ caches_action :symbol_cache_path , cache_path : :cache_path_protected_method
38
39
caches_action :with_layout
39
40
caches_action :with_format_and_http_param , cache_path : Proc . new { |c | { key : 'value' } }
40
41
caches_action :with_symbol_format , cache_path : 'http://test.host/action_caching_test/with_symbol_format'
@@ -97,6 +98,7 @@ def simple_runtime_error
97
98
alias_method :edit , :index
98
99
alias_method :destroy , :index
99
100
alias_method :custom_cache_path , :index
101
+ alias_method :symbol_cache_path , :index
100
102
alias_method :layout_false , :with_layout
101
103
alias_method :with_layout_proc_param , :with_layout
102
104
@@ -126,6 +128,12 @@ def invalid
126
128
format . json { render json : @cache_this }
127
129
end
128
130
end
131
+
132
+ protected
133
+
134
+ def cache_path_protected_method
135
+ [ 'controller' , params [ :id ] ] . compact . join ( '-' )
136
+ end
129
137
end
130
138
131
139
class MockTime < Time
@@ -339,6 +347,16 @@ def test_action_cache_with_custom_cache_path_with_custom_object
339
347
assert fragment_exist? ( 'controller-1' )
340
348
end
341
349
350
+ def test_action_cache_with_symbol_cache_path
351
+ get :symbol_cache_path
352
+ assert_response :success
353
+ assert fragment_exist? ( 'controller' )
354
+
355
+ get :symbol_cache_path , id : 1
356
+ assert_response :success
357
+ assert fragment_exist? ( 'controller-1' )
358
+ end
359
+
342
360
def test_cache_expiration
343
361
get :index
344
362
assert_response :success
0 commit comments