Modules and models

We have decided to wrap each of our model classes in a module, where the module name is currently the same across all models and is the name of the application. So, for example, we have:

module SpringBase   class User < ActiveRecord::Base         ...         end end

My reading suggests that I should site all model files in the directory app/models/spring_base/ to, I hope, help Rails to find them when I have code such as in my controller logic.

Is this the correct approach?


We want to namespace our code to avoid conflicts with any framework code. For example, we had a method called 'changed' in our models which clashed with an ActiveRecord-based rmethod of the same name and this led to many hours of debugging.

My research suggests it is valid to namespace models and that one should use the same approach as for namespacing controllers.