Actions
Patch #32887
closedRails 6: Use "render template:" instead of "render file:" in app/views/layouts/admin.html.erb
Description
$ bin/rails test test/functional/admin_controller_test.rb . . . DEPRECATION WARNING: render file: should be given the absolute path to a file (called from _app_views_layouts_admin_html_erb___682843397516142584_70111060943800 at /path/to/redmine/app/views/layouts/admin.html.erb:8)
The behavior has changed by this commit:
https://github.com/rails/rails/commit/c7820d8124c854760a4d288334f185de2fb99446
According to the commit log, the only difference between render file:
and render template:
before Rails 6 is that render file:
can specify the absolute path of templates.
app/views/layouts/admin.html.erb
does not use an absolute path to specify the template, so you can suppress deprecation warning by replacing render file:
with render template:
.
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index 8f23129b4..0ce74d104 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -5,4 +5,4 @@
<% end %>
<% end %>
-<%= render :file => "layouts/base" %>
+<%= render :template => 'layouts/base' %>
</diff>
Related issues
Actions