On Oct 10, 10:17 am, "dev.mykey" <[EMAIL PROTECTED]> 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

>
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to