Forum: Ruby Cookbook2 tutorial error: The error occured while evaluatin

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-02-05 18:09
(Received via mailing list)
I am following the Cookbook2 tutorial on the InstantRails website ( ).  I am almost
finshed with the tutorial but have started getting the following error:

 NoMethodError in Recipe#list

Showing app/views/recipe/list.rhtml where line #24 raised:

You have a nil object when you didn't expect it!
The error occured while evaluating

Extracted source (around line #24):

21:  :confirm => "Really delete #{recipe.title}?" %>
22:  </font>
23:  </td>
24:  <td><%= %></td>
25:  <td><%= %></td>
26:  </tr>
27:  <% end %>

RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace


And here are the first three lines of the Full Trace:


I have attempted double checking the code throughout the tutorial, but
I am just not seeing what is causing the error.  I figure it is a small
typing error, but I do not know how to isolate which section of code it
is in.  Any suggestions would be welcomed.

Thank you for your time.

unknown (Guest)
on 2006-02-05 18:15
(Received via mailing list)
I forgot to mention I am getting the error when  I attempt to "add a
new recipe like the one shown in Figure 56.".

John (Guest)
on 2006-02-05 21:10
(Received via mailing list)
Well I figured it out in case anyone searches for this same problem...
The receipe table had a row with a category_id of 0.  Note that the
category table does not have a row for 0.

Not sure how this wound up in the DB like that, but I manually fixed it
by changing the 0 to a 1.

Hope this helps someone else learning ruby!
Curt Hibbs (Guest)
on 2006-02-06 05:43
(Received via mailing list)
Thanks, I'll see if we can get something added to the tutorial about

This topic is locked and can not be replied to.