superstar3000
superstar3000

Reputation: 399

Classes in subfolders in app/models don't get loaded?

I would like to have a folder of related Models in my Rails 4 app. Why don't classes in app/models/debt_models get loaded?

I guess there is a work around by how come Rails just doesn't recursively go through folders under app/models? Is there a reason? Seems like this is something Rails should do without me having to tell Rails to do that.

Upvotes: 1

Views: 92

Answers (1)

apneadiving
apneadiving

Reputation: 115511

You just have to follow conventions. If you put models in debt_models, it means you namespace them like:

module DebtModels
  class Foo

Path: app/models/debt_models/foo.rb

Upvotes: 3

Related Questions