Rails 6: Use "render template:" instead of "render file:" in app/views/layouts/admin.html.erb
|Assignee:||Go MAEDA||% Done:|
$ 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:
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
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>
- Subject changed from Rails 6: Use "render template" instead of "render file" in app/views/layouts/admin.html.erb to Rails 6: Use "render template:" instead of "render file:" in app/views/layouts/admin.html.erb
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version set to 4.2.0
Committed the patch.