Forum: Ruby on Rails Error when trying Rolling with Ruby On Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1ead77b1e91f1de5dcb1245e9e779350?d=identicon&s=25 Stephen Ng (Guest)
on 2006-03-07 09:05
(Received via mailing list)
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: <body>
6: <h1>Edit Recipe</h1>
7:
8: <form action="../update/<%= @recipe.id %>" method="POST">
9: <input id="recipe_id" name="recipe[id]" size="30"
10: type="hidden" value="<%= @recipe.id %>" />
11: <p><b>Title</b><br>

|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
415a80eb88afdd18a5b776992ef9e12b?d=identicon&s=25 pmt (Guest)
on 2006-03-07 09:16
Are you sure @recipe is not nil ??

pmt
This topic is locked and can not be replied to.