# Model classes into module = superclass mismatch

**URL:** <https://www.ruby-forum.com/t/model-classes-into-module-superclass-mismatch/48791>\
**Category:** Rails\
**Created:** [November 24, 2005, 8:16pm UTC](https://www.ruby-forum.com/t/model-classes-into-module-superclass-mismatch/48791 "2005-11-24T20:16:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/51bf81/32.png) [@luca](https://www.ruby-forum.com/u/luca)\
**Post date:** [November 24, 2005, 8:16pm UTC](https://www.ruby-forum.com/t/model-classes-into-module-superclass-mismatch/48791/1 "2005-11-24T20:16:31Z")

</div>

Hello. I’d like to put all my data model classes into a module to avoid  
name  
clashes with other classes. However, when I do so, I get a superclass  
mismatch error. My class hierarchy for the class in question looks like  
this:

class ViewCTI \< ActiveRecord::Base  
end

module ORM  
class Molecule \< ViewCTI  
end  
end

I load the model classes from the ApplicationController class  
class ApplicationController \< ActionController::Base  
model :orm  
layout ‘layouts/standard’  
end

When I try to execute a controller I get the following error:  
TypeError in #  
superclass mismatch for class Molecule

RAILS\_ROOT: .  
Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/app/models/orm.rb:51  
#{RAILS\_ROOT}/app/controllers/application.rb:4  
This error occured while loading the following files:  
./app/controllers/application.rb  
=\> model orm.rb  
orm.rb

Any ideas why this might be happening? Are there any special  
considertations  
to be kept in mind if collecting the model classes in a separate module?

Thanks

Luca
