Skip to content

Commit 876cc27

Browse files
author
David Heinemeier Hansson
authored
Revert "Deprecate rendering templates with . in the name" (rails#39012)
1 parent 2a12b72 commit 876cc27

File tree

6 files changed

+8
-27
lines changed

6 files changed

+8
-27
lines changed

actionpack/test/controller/render_test.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ def test_dynamic_render_with_absolute_path
365365
def test_dynamic_render
366366
assert File.exist?(File.expand_path("../../test/abstract_unit.rb", __dir__))
367367
assert_raises ActionView::MissingTemplate do
368-
assert_deprecated do
369-
get :dynamic_render, params: { id: '../\\../test/abstract_unit.rb' }
370-
end
368+
get :dynamic_render, params: { id: '../\\../test/abstract_unit.rb' }
371369
end
372370
end
373371

actionpack/test/controller/renderer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_render_component
109109
xml = "<p>Hello world!</p>\n"
110110

111111
assert_equal html, render["respond_to/using_defaults"]
112-
assert_equal xml, assert_deprecated { render["respond_to/using_defaults.xml.builder"] }
112+
assert_equal xml, render["respond_to/using_defaults.xml.builder"]
113113
assert_equal xml, render["respond_to/using_defaults", formats: :xml]
114114
end
115115

actionview/lib/action_view/template/resolver.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@ def reject_files_external_to_app(files)
227227
end
228228

229229
def find_template_paths_from_details(path, details)
230-
if path.name.include?(".")
231-
ActiveSupport::Deprecation.warn("Rendering actions with '.' in the name is deprecated: #{path}")
232-
end
233-
234230
query = build_query(path, details)
235231
find_template_paths(query)
236232
end
@@ -335,11 +331,6 @@ def find_candidate_template_paths(path)
335331
end
336332

337333
def find_template_paths_from_details(path, details)
338-
if path.name.include?(".")
339-
# Fall back to the unoptimized resolver, which will warn
340-
return super
341-
end
342-
343334
candidates = find_candidate_template_paths(path)
344335

345336
regex = build_regex(path, details)

actionview/test/template/fallback_file_system_resolver_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def setup
88
end
99

1010
def test_should_have_no_virtual_path
11-
templates = @root_resolver.find_all("hello_world", "#{FIXTURE_LOAD_PATH}/test", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
11+
templates = @root_resolver.find_all("hello_world.erb", "#{FIXTURE_LOAD_PATH}/test", false, locale: [], formats: [:html], variants: [], handlers: [:erb])
1212
assert_equal 1, templates.size
1313
assert_equal "Hello world!", templates[0].source
1414
assert_nil templates[0].virtual_path

actionview/test/template/render_test.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,7 @@ def test_render_partial_from_default
200200
def test_render_outside_path
201201
assert File.exist?(File.expand_path("../../test/abstract_unit.rb", __dir__))
202202
assert_raises ActionView::MissingTemplate do
203-
assert_deprecated do
204-
@view.render(template: "../\\../test/abstract_unit.rb")
205-
end
203+
@view.render(template: "../\\../test/abstract_unit.rb")
206204
end
207205
end
208206

@@ -340,10 +338,8 @@ def test_render_partial_collection
340338
end
341339

342340
def test_render_partial_collection_with_partial_name_containing_dot
343-
assert_deprecated do
344-
assert_equal "Hello: davidHello: mary",
345-
@view.render(partial: "test/customer.mobile", collection: [ Customer.new("david"), Customer.new("mary") ])
346-
end
341+
assert_equal "Hello: davidHello: mary",
342+
@view.render(partial: "test/customer.mobile", collection: [ Customer.new("david"), Customer.new("mary") ])
347343
end
348344

349345
def test_render_partial_collection_as_by_string
@@ -583,11 +579,7 @@ def test_render_does_not_use_unregistered_extension_and_template_handler
583579
def test_render_ignores_templates_with_malformed_template_handlers
584580
%w(malformed malformed.erb malformed.html.erb malformed.en.html.erb).each do |name|
585581
assert File.exist?(File.expand_path("#{FIXTURE_LOAD_PATH}/test/malformed/#{name}~")), "Malformed file (#{name}~) which should be ignored does not exists"
586-
assert_raises(ActionView::MissingTemplate) do
587-
ActiveSupport::Deprecation.silence do
588-
@view.render(template: "test/malformed/#{name}")
589-
end
590-
end
582+
assert_raises(ActionView::MissingTemplate) { @view.render(template: "test/malformed/#{name}") }
591583
end
592584
end
593585

actionview/test/template/resolver_shared_tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_templates_sort_by_formats_html_first
169169
def test_virtual_path_is_preserved_with_dot
170170
with_file "test/hello_world.html.erb", "Hello html!"
171171

172-
template = assert_deprecated { context.find("hello_world.html", "test", false, [], {}) }
172+
template = context.find("hello_world.html", "test", false, [], {})
173173
assert_equal "test/hello_world.html", template.virtual_path
174174

175175
template = context.find("hello_world", "test", false, [], {})

0 commit comments

Comments
 (0)