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

support scope with association

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Associations
    • None

      How about support scope with mongoid like what ActiveRecord does

      In some case

      class Post
        include Mongoid::Document
        field :is_private, Boolean
        belongs_to :user
      end
      
      class User
        has_many :posts
      
        has_many :private_posts, -> { where(is_private: true) }
      end
      

      if there is no scope support in association, what's the mongoid's way to support the scene?

            Assignee:
            Unassigned Unassigned
            Reporter:
            fengqingqing1992@gmail.com 向阳 徐
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: