File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
lib/action_controller/metal Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def determine_template_etag(options)
44
44
# template digest from the ETag.
45
45
def pick_template_for_etag ( options )
46
46
unless options [ :template ] == false
47
- options [ :template ] || " #{ controller_path } / #{ action_name } "
47
+ options [ :template ] || lookup_context . find_all ( action_name , _prefixes ) . first &. virtual_path
48
48
end
49
49
end
50
50
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ def hello_world
66
66
end
67
67
end
68
68
69
+ class InheritedRenderTestController < ImplicitRenderTestController
70
+ def hello_world
71
+ fresh_when ( etag : "abc" )
72
+ end
73
+ end
74
+
69
75
class TestController < ActionController ::Base
70
76
protect_from_forgery
71
77
@@ -677,6 +683,28 @@ def test_etag_reflects_template_digest
677
683
end
678
684
end
679
685
686
+ class InheritedEtagRenderTest < ActionController ::TestCase
687
+ tests InheritedRenderTestController
688
+ include TemplateModificationHelper
689
+
690
+ def test_etag_reflects_template_digest
691
+ get :hello_world
692
+ assert_response :ok
693
+ assert_not_nil etag = @response . etag
694
+
695
+ request . if_none_match = etag
696
+ get :hello_world
697
+ assert_response :not_modified
698
+
699
+ modify_template ( "implicit_render_test/hello_world" ) do
700
+ request . if_none_match = etag
701
+ get :hello_world
702
+ assert_response :ok
703
+ assert_not_equal etag , @response . etag
704
+ end
705
+ end
706
+ end
707
+
680
708
class MetalRenderTest < ActionController ::TestCase
681
709
tests MetalTestController
682
710
You can’t perform that action at this time.
0 commit comments