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

Allow specifying scope in association declarations

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      ActiveRecord permits defining scope on associations when association is declared. Per https://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_one:

      has_one :vehicle, -> { where(name: 'Car') }
      

      Mongoid does not appear to support scopes in any of its association definitions.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: