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

Try the “rails console” command on your shell
then type “x = Zombie.find(1).name”

Thanks for the reply,

Unfortunately, the tutorial provides the console and it’s expecting only
a working answer.

x = Zombie.find(1).name

returns the same error I’m afraid.

Never mind, I’m an idiot. I assumed the objective was to get the
zombie’s name. All it was asking for was the entry in the db. The
first line was sufficient…

Thanks for the help.