You have a nil object when you didn't expect it!


#1

<% if @flash[:error] %>

<%= @flash[:error] %>

<% end %>
<% if @flash[:warning] %>
<%= @flash[:warning] %>

<% end %>
<% if @flash[:notice] %>
<%= @flash[:notice] %>

<% end %>

You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

How I must do it?


#2

Hi,

Did you see any line number in the error?
It would be helpful if you gould give the whole trace rather than just
the
error message

NAYAK

On Fri, Jan 9, 2009 at 3:36 PM, Gi Ga
removed_email_address@domain.invalidwrote:

  • NAYAK

#3

How I must do it?
could it be, it’s “flash[:notice]” without the @.

if not, tell us where your error occurred (which line). then show us
the code calling it (controller/action).


#4

MaD wrote:

could it be, it’s “flash[:notice]” without the @.

Thanks, now it works.