Forum: Ruby on Rails model classes into module = superclass mismatch

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.
67800acb8e18674976b4a90b7463660f?d=identicon&s=25 luca (Guest)
on 2005-11-24 20:16
(Received via mailing list)
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 <controller not set>#<action not set>
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
This topic is locked and can not be replied to.