support scope with association

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Associations
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
              Reporter:
              向阳 徐
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: