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

Allow default_scope on relations

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I'd like to be able to do something like this:

      belongs_to :shop, class_name: 'AppShared::Shop', default_scope: ->{ asc(:name) }
      

      I can think of two use cases:

      1) Set sort order on relations
      2) When using Mongoid::Paranoid, use "unscoped" on the relation to get deleted objects.

      Any thoughts?

            Assignee:
            Unassigned Unassigned
            Reporter:
            johnnyshields Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: