[Rails] Single Table Inheritance

Mando Escamilla mando.escamilla at gmail.com
Sun Nov 14 06:01:27 GMT 2004


I must be missing something, but I can't quite seem to get single
table inheritance to work.  I keep getting NameError: uninitialized
constant Admin :(.

I have a User table with a 'type' column and the corresponding models:

user.rb:
require 'active_record'

class User < ActiveRecord::Base
  
  def self.table_name() "user" end

end

admin.rb:
require 'user'

class Admin < User
end

When I try to access any User (either via a test fixture or db record)
I get the NameError.

What am I doing wrong?

--
Mando


More information about the Rails mailing list