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