0

これらの次の行を使用する私の Rails アプリケーションでは、ActionTemplate:Error (スタック レベルが深すぎます) が発生しています。すべてが同じコードで正常に機能していましたが、突然アプリケーションがこのエラーをスローし始めました。

<% if (not flash[:notice].nil? and not flash[:notice].empty?) or (not flash[:warning].nil? and not flash[:warning].empty?) %>
  <center>
    <div style="background-color:lightyellow; border: 1px solid gold; width: 95%; padding: 3px; text-align: left;">
      <font color=green>
        <i>
          <b>
            <%= flash[:notice] %>
            <% if !flash[:warning].blank? %>
              <%= "<BR/>" if !flash[:notice].blank?%>
              <%= image_tag "warning.ico", :size => "32x32" %>&nbsp;<%= flash[:warning] %>
            <% end %>
          </b>
        </i>
      </font>
      <br/>
    </div>
  </center>
  <% flash[:notice] = flash[:warning] = "" %>
<% end %>

開発ログにスローされるエラーは

    ActionView::TemplateError (stack level too deep) on line #182 of app/views/layouts/loggedin.rhtml:
    179:                    </font>
    180:                    <br/>
    181:            </div>
    182:            <% if (not flash[:notice].nil? and not flash[:notice].empty?) or        (not flash[:warning].nil? and not flash[:warning].empty?) %>
    183:                    <center>
    184:                            <div style="background-color:lightyellow; border:     1px solid gold; width: 95%; padding: 3px; text-align: left;">
    185:                                    <font color=green>

app/views/layouts/loggedin.rhtml:182:in `_run_rhtml_app47views47layouts47loggedin46rhtml'
app/controllers/testcases_controller.rb:1337:in `view'

ここで解決策を教えていただければ幸いです。前もって感謝します。

4

0 に答える 0