# Undefined?

**URL:** <https://www.ruby-forum.com/t/undefined/94697>\
**Category:** Rails\
**Created:** [May 11, 2006, 11:22am UTC](https://www.ruby-forum.com/t/undefined/94697 "2006-05-11T11:22:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [May 11, 2006, 11:22am UTC](https://www.ruby-forum.com/t/undefined/94697/1 "2006-05-11T11:22:32Z")

</div>

When following the ONrails “Rolling on Ruby with Rails” tutorial part1 I  
(already) encountered the first complication.

After doing those basic actions to set up the basic site, the tutorial  
tells me to overwrite the “list” method included in the “scaffold  
:recipe” method which we find in the recipe controller with this code:

def list  
@recipes = recipe.find\_all  
end

Now this code doesn’t work. When trying to view my site I keep getting  
an error message which says that the variable recipe is undefined.  
With the (average) knowledge I own concerning programming I suppose  
“@recipes” should define the variable, which doesn’t happen here.

I searched half [rubyonrails.org](http://rubyonrails.org) looking for another way of defining that  
variable, but it’s alway “@recipe”. I followed every step in that  
tutorial closely, does anyone know what’s wrong? I use Ruby version  
182-14.

thx in advance

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [May 11, 2006, 11:49am UTC](https://www.ruby-forum.com/t/undefined/94697/2 "2006-05-11T11:49:47Z")

</div>

Hi,

You don’t need to define variables in Ruby.

The problem is likely to be the case of the class you’re calling. The  
line should read:

@recipes = Recipe.find\_all

Hope that helps,

Steve

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [May 11, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/undefined/94697/3 "2006-05-11T20:40:51Z")

</div>

On Thu, May 11, 2006 at 11:22:32AM +0200, Simon wrote:

> Now this code doesn’t work. When trying to view my site I keep getting  
> an error message which says that the variable recipe is undefined.  
> With the (average) knowledge I own concerning programming I suppose  
> “@recipes” should define the variable, which doesn’t happen here.

I suspect that you want Recipe.find\_all, not recipe.find\_all.

- Matt
