mongoid/mongoid — Issue #1681: create_indexes doesn't work with non-namespaced models in app/models subdirectory
Author: bensymonds
Created: 2012-02-06 13:51:53+00:00
State: open

We have some of our models in subdirectories, purely to make file organisation cleaner. The models are *not* namespaced. E.g.

```ruby
class Follow
end

class Unfollow
end

app/models/notifications/follow.rb
app/models/notifications/unfollow.rb
```

The code in `Rails::Mongoid#determine_model` assumes anything in a subdirectory is namespaced, and therefore doesn't work with the above structure (it thinks the classes would be `Notifications::Follow` and `Notifications::Unfollow`.

I really hate digging around in this sort of thing (autoloading of files). Does anyone know of a quick solution?