# Would you help about const\_missing error

**URL:** <https://www.ruby-forum.com/t/would-you-help-about-const-missing-error/150610>\
**Category:** Rails\
**Created:** [October 10, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/would-you-help-about-const-missing-error/150610 "2008-10-10T12:24:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev.mykey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@dev.mykey](https://www.ruby-forum.com/u/dev.mykey)\
**Post date:** [October 10, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/would-you-help-about-const-missing-error/150610/1 "2008-10-10T12:24:27Z")

</div>

Hello.

I have made a model name is User, so have created “users” table.  
and I made Customer class inhrtied by User Class.

When I call the Customer class in some controller, the controller  
passed error msg to me.

It seems that controller doesn’t find table(“users”) when make  
Customer instance.

previously, thanks for your help.

error message -----------------------------

NameError in MemberController#signup  
uninitialized constant MemberController::Customer

RAILS\_ROOT: C:/Documents and Settings/Administrator/My Documents/  
Aptana Studio/pseudo

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active\_support/  
dependencies.rb:493:in `const_missing' app/controllers/ member_controller.rb:9:in`signup’-e:2:in `load’-e:2

here is pieces of controller and model code

----------------------- controller --------------------------------  
class MemberController \< ApplicationController

def signup  
if request.post?  
@member = Customer.new(params[:user])  
if @member.save

```
  end
end

```

end

-------------------------- model ------------------------------------  
class User \< ActiveRecord::Base

end

class Customer \< User  
def initailize  
self.type = ‘Customer’  
end  
end

## class Manager \< Employee def initailize self.type = ‘Manager’ end

my application’s environment

Ruby version 1.8.6 (i386-mswin32)  
RubyGems version 1.3.0  
Rails version 2.1.1  
Active Record version 2.1.1  
Action Pack version 2.1.1  
Active Resource version 2.1.1  
Action Mailer version 2.1.1  
Active Support version 2.1.1  
Application root C:/Documents and Settings/Administrator/My Documents/  
Aptana Studio/pseudo  
Environment development  
Database adapter mysql

---

<div class="post-metadata">

**Author:** ![dev.mykey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@dev.mykey](https://www.ruby-forum.com/u/dev.mykey)\
**Post date:** [October 10, 2008, 12:28pm UTC](https://www.ruby-forum.com/t/would-you-help-about-const-missing-error/150610/2 "2008-10-10T12:28:34Z")

</div>

On Oct 10, 10:17 am, “dev.mykey” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello.
> 
> I have made a model name is User, so have created “users” table.  
> and I made Customer class inhrtied by User Class.
> 
> When I call the Customer class in some controller, the controller  
> passed error msg to me.
> 
> It seems that controller doesn’t find table(“users”) when make  
> Customer instance.

No, it’s not finding your customer class because it’s not in  
customer.rb.  
Either put Customer in customer.rb or require user with  
require\_dependency

ALso you don’t need that initializer to set the type column (rails  
will do that for you). It’s also not how initialize is spelled.  
Fred
