# Uninitialized constant error, help me

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-error-help-me/151491>\
**Category:** Rails\
**Created:** [October 22, 2008, 7:22am UTC](https://www.ruby-forum.com/t/uninitialized-constant-error-help-me/151491 "2008-10-22T07:22:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sukury47](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@sukury47](https://www.ruby-forum.com/u/sukury47)\
**Post date:** [October 22, 2008, 7:22am UTC](https://www.ruby-forum.com/t/uninitialized-constant-error-help-me/151491/1 "2008-10-22T07:22:17Z")

</div>

Hi, I’m a rails\_fan in korea.

As korean web site has a little information about rails  
I’m tryig to ask google groups users of my question

\<% for reserve in @plan.reserves %\>

This line make error like this ‘uninitialized constant Plan::Reserf’

I already have plan and reserve model  
and I define their relationship.

plan  
has\_many :reserves

reserve  
belongs\_to :plan

why does this error happen?

---

<div class="post-metadata">

**Author:** ![sukury47](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@sukury47](https://www.ruby-forum.com/u/sukury47)\
**Post date:** [October 22, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-error-help-me/151491/2 "2008-10-22T15:24:07Z")

</div>

On Tue, Oct 21, 2008 at 11:06 AM, sukury47 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> reserve  
> belongs\_to :plan
> 
> why does this error happen?

First, check that your models are defined correctly.

- a Plan class defined in app/models/plan.rb

class Plan \< ActiveRecord::Base  
has\_many :reserves  
end

- a Reserve class defined in app/models/reserve.rb

class Reserve \< ActiveRecord::Base  
belongs\_to :plan  
end

Second, check the spelling: Reserf should be Reserve. Third, make sure  
that  
you do NOT define Reserve with a Plan namespace

class Plan::Reserve \< ActiveRecord::Base  
belongs\_to :plan  
end

If you’ve defined Reserve like this, change it to the one shown above.

Those are some ideas for why you might be receiving that error. Please  
let  
us know if any of them help.

Regards,  
Craig
