Forum: Ruby on Rails Extending ActiveRecord creates TypeError

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2ff47d48fde7f8f2d1e25ab7ccc87d00?d=identicon&s=25 Peter Brown (Guest)
on 2006-02-09 21:32
(Received via mailing list)
Hi.

I have want to use the following arrangement: Model < CustomClass <
ActiveRecord::Base

My CustomClass has a bunch of code I want to be held in common to all
my models.

What happens however is that if I access a controller that uses
Model, it works. Then on the second view (hitting reload) I always get:

TypeError (superclass mismatch for class User):
     /app/models/account/user.rb:4
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:207:in `load'
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:207:in `load'
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:39:in `require_or_load'
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:22:in `depend_on'
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:178:in `require_dependency'
     /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:178:in `require_dependency'
     /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/dependencies.rb:72:in `require_dependencies'
     /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/dependencies.rb:70:in `each'
     /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/dependencies.rb:70:in `require_dependencies'
     /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/dependencies.rb:35:in `model'
     .//app/controllers/account_controller.rb:4


I don't understand why! Does AR modify the superclass in some way
that makes extending model classes impossible?

Thanks
This topic is locked and can not be replied to.