<%# Flash-based notifications %>
<% if flash[:error].present? or flash[:notice].present? %>
<div class="messages <%= flash[:error] ? 'error' : 'notice' %>">
<ul id="feedback">
<% if flash[:error].present? %>
<li><%= flash[:error] %></li>
<% end %>
<% if flash[:notice].present? %>
<li><%= flash[:notice] %></li>
<% end %>
</ul>
</div>
<% end %>
For some reason, as it seems, my attempt to read from a flash drive inside a partial file causes this error, since the flash is set to nil. Do I need to initialize it manually or something else?
This is Rails 3.1.0. The error is on line 2 of the code snippet where it is trying to access flash[:error].
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
Something is missing for me. I definitely do not cancel it anywhere.
source
share