Model classes into module = superclass mismatch


#1

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