プロジェクト

全般

プロフィール

Vote #80630

完了

Rails 6: Use "render template:" instead of "render file:" in app/views/layouts/admin.html.erb

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Rails support_44
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
44
version_id:
152
issue_org_id:
32887
author_id:
332
assigned_to_id:
332
comments:
2
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

$ 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' %>


journals

Committed the patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,29914,Migrate to Rails 6.1 with Zeitwerk autoloading

Admin Redmine さんが4年以上前に更新

  • カテゴリRails support_44 にセット
  • 対象バージョン4.2.0_152 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0