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

I've got a list of members in a sidebar using the code below. It works
great for the list page, but when I edit or add a new member I get
"You have a nil object when you didn't expect it!" - I have a hunch
this is just a nooby mistake, but I'm at a loss. Any help would be
greatly appreciated!

<% for member in @members %>
<li><%= link_to h(member.first_name) + " " + h(member.last_name),
edit_member_path(player) %></li>
<% end %>

Kedron -

I've got a list of members in a sidebar using the code below. It works
great for the list page, but when I edit or add a new member I get
"You have a nil object when you didn't expect it!" - I have a hunch
this is just a nooby mistake, but I'm at a loss. Any help would be
greatly appreciated!

<% for member in @members %>
<li><%= link_to h(member.first_name) + " " + h(member.last_name),
edit_member_path(player) %></li>
<% end %>

Your log file will tell you more - like the line number (it's a stack trace).

generally one of your variables is a nil. The line number should help.

You could try logging the values out. Some people would use the built in debugger to help out.

cheers,
Jodi

Thanks Jodi for the quick response!

The log says its the first line:

<% for player in @players %>

Kedron -