How to organize models into modules

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs