Error when trying Rolling with Ruby On Rails


#1

Hi everyone!

Please excuse my ignorance!

I was working through the Rolling with Ruby tutorial to get a feel of
things. Everything seems to work until I tried editing as in the last
example in part 2 when I got the following error -

|Called id for nil, which would mistakenly be 4 – if you really wanted the id of nil, use object_id
|||

Extracted source (around line #8):

|5:
6:

Edit Recipe


7:
8:
9: <input id=“recipe_id” name=“recipe[id]” size=“30”
10: type=“hidden” value="<%= @recipe.id %>" />
11:

Title

|Can anyone explain what happened here? Since all the code is generated
by Rails scripts, I was wondering if I have some verison
incompatibility.

Thanks.

Stephen Ng


#2

Are you sure @recipe is not nil ??

pmt