Skip to content

Commit f86b750

Browse files
committed
fix: errors/showパーシャルでの変数の受け渡しを修正
Rambulanceのレンダリングコンテキストにおいて、 を使った変数の受け渡しが 意図通りに動作しない問題があったため、 よりシンプルで確実なローカル変数を直接使う方式に変更。 - インスタンス変数(@変数)の使用をやめ、ローカル変数に統一。 - これにより、ビューとヘルパーが正しく連携し、 500エラーが発生する問題が解消される。
1 parent 4457879 commit f86b750

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/views/errors/show.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<% @status_code = local_assigns[:status_code].to_i %>
2-
<% @title = error_title(@status_code) %>
3-
<% @desc = error_desc(@status_code) %>
1+
<%# The status_code local variable is passed from the parent template %>
2+
<% title = error_title(status_code) %>
3+
<% desc = error_desc(status_code) %>
44

5-
<% provide(:title, @title) %>
6-
<% provide(:desc, @desc) %>
5+
<% provide(:title, title) %>
6+
<% provide(:desc, desc) %>
77

88
<div id="top" class="title text-center">
99
<i class="cd cd-logo"></i>
@@ -13,9 +13,9 @@
1313
</div>
1414

1515
<section class="introduction text-center list">
16-
<h2><%= @title %></h2>
16+
<h2><%= title %></h2>
1717
<p>
18-
<%= @desc %>
18+
<%= desc %>
1919
<br>
2020
</p>
2121
<p>

0 commit comments

Comments
 (0)