Forum: Ruby on Rails How to organize models into modules

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.
8f23570fbde6277118fcd088a675f61a?d=identicon&s=25 Josh (Guest)
on 2006-03-29 23:05
Being a bit of a neat freek, I would like to organize the models in my
Rails app into modules.  I have created the directory structure as
follows:

models
 |- module1
     |- mymodel.rb

And my model class code is:

module Module1
 class Mymodel
  ...some stuff
 end
end

How do I include this model in my controllers without referencing it as
"Module1::Mymodel"?  Also, how do I reference it in other model classes
(e.g. in a belongs_to statement)?

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