Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., @awscloud, former CTO @artsy, +@vestris, NYC

Email Twitter LinkedIn Github Strava
Creative Commons License

One thing that has been irritating me is the default Rails app/models directory. It doesn’t support subdirectories, so models that deal with the database and classes that deal with overriding methods in core classes are often put in the same app/models directory. Putting apples next to potatoes doesn’t make our kitchen well-organized.

This can be easily fixed by telling Rails to load all sub-directories under models, in config/application.rb.

# Load all subdirectories of app/models.
config.autoload_paths += Dir["#{Rails.root}/app/models/\*\*/\*"]