[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Cookbook2 tutorial error: The error occured while evaluating nil.name

thundercleesed

2/5/2006 5:04:00 PM

I am following the Cookbook2 tutorial on the InstantRails website (
http://instantrails.rubyforge.org/tutorial/... ). 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 nil.name

Extracted source (around line #24):

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

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

#{RAILS_ROOT}/app/views/recipe/list.rhtml:24
#{RAILS_ROOT}/app/views/recipe/list.rhtml:11


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


C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:268:in
`compile_and_render_template'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:244:in
`render_template'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/base.rb:205:in
`render_file'

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.

John

4 Answers

thundercleesed

2/5/2006 5:08:00 PM

0

I forgot to mention I am getting the error when I attempt to "add a
new recipe like the one shown in Figure 56.".

Thanks,
John

thundercleesed

2/5/2006 8:06:00 PM

0

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

2/6/2006 4:43:00 AM

0

Thanks, I'll see if we can get something added to the tutorial about this.

Curt

On 2/5/06, John <thundercleesed@gmail.com> wrote:
> 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!
>
>
>


Escape_the_Cult_Now

8/11/2009 1:37:00 AM

0


"Wikking" <Wik.King!@yahoo.co.uk> wrote in message
news:h5q6mp$qfd$3@news.eternal-september.org...
> China Blue Man Group wrote:
>> In article
>> <b386c444-60a5-455b-9065-119d42e907f3@d23g2000vbm.googlegroups.com>,
>> "BIRTH FIRST!" <progressive_libertarian@yahoo.com> wrote:
>>
>>> http://www.latimes.com/news/nationworld/washingtondc/la-naw-pelosi-h...
>>> h11-2009aug11,0,4079175.story
>>>
>>>> Pelosi, Hoyer call disruptions 'un-American'
>>>>
>>>> House Speaker Nancy Pelosi and Majority Leader Steny Hoyer,
>>>> insisting at the start of a long and politically heated summer
>>>> congressional recess that healthcare reform can be
>>>> achieved this fall, today are calling the disruption of "town-hall''
>>>> meetings by vocal protesters "simply un-American.''
>>> Freedom of speech is "un-American"??
>>
For additional information

http://abclocal.go.com/kgo/story?section=news/politics&...

In a characteristic Pelosi moment a deranged Nasty Pelosi
claimed that all that don't agree with her or Obama are
Nazis and that they all wear Nazi symbols...a scientology-
laden technique used in pathetic attempts to silence critics.

"Pelosi's swastika claims are a crock." Democrat thugs spent
years abusing speeches and planting people at town halls. It
is likely they plan on wearing them and falsly accusing others
of doing so.

But the point. Nancy Pelosi seems to HATE middle to elderly
aged people and has self-hatred toward herself (of course,
we all know why) but Nancy Pelosi needs to deal with her
own self-hatred. She is not a friend to whites, blacks, or
anybody in-between. She will lie at whim following the same
scientology technique. The legislator group she belong(ed)
to was filled with infitrators from the crime cult of
scientology. She is propped up. It's time to call her out.


pppppppppppppppppp