Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1682

create_indexes doesn't work with non-namespaced models in app/models subdirectory

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.5
    • Affects Version/s: None
    • Component/s: None

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

      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?

            Assignee:
            Unassigned Unassigned
            Reporter:
            bensymonds Ben Symonds
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: