I am trying to configure unidirectional inheritance in my Rails application for a user model and its subclasses Member, Subscriber and Staff.
I have a model file for each: user.rb, member.rb, etc.
User model defined: class User < ActiveRecord::Base; end; class User < ActiveRecord::Base; end; I have subclassed other models as such: class Member < User; end; class Member < User; end; etc.
In my users table, I have all the fields that every class needs plus a type field. Now, when I go to the console and try to create a new instance of the member or subscriber, I get the following error:
TypeError: can't dup NilClass from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2184:in 'dup' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2184:in 'scoped_methods' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2188:in 'current_scoped_methods' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2171:in 'scoped?' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2439:in 'send' from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2439:in 'initialize' from (irb):6:in 'new' from (irb):6
Rails knows that subclass models exist because in the console, when I just call Member or Subscriber, I return the class definition.
I read simple documentation, but am I missing something?
source share