Wednesday, May 18, 2011

[Rails] NoMethodError

Hi All,

I'm working on a tutorial and am already stumped on the very first
question... I can't seem to figure it out. Here are the details:


Objective
Find Zombie where id = 1 and store it in a variable

Resources
zombies
id name graveyard
1 Ash Glen Haven Memorial Cemetary
2 Bob Chapel Hill Cemetary
3 Jim My Fathers Basement


Here's what I've tried:

t = Zombie.find(1)
x = t.name

and here's the error I keep getting (or some similar variation):

Sorry, Try Again
#<NoMethodError: undefined method `id' for "Ash":String>


I've tried a ton of different variations, but am obviously approaching
the problem incorrectly. Can anyone help me out?

Thanks!
Ryan

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate