-
Type: Task
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 5.0.2
-
Component/s: Query
-
None
-
2
Hi
I do soft-delete for some Mongoid models:
class Comment include Mongoid::Document belongs_to :author end class Author include Mongoid::Document has_many :comments default_scope -> { where(deleted_at: nil) } end
For avoiding N+1 while listings comments and authors, I would like to `Comments.includes(:author)`, but I do want to include deleted authors for that querying, meaning that I want to skip the `default_scope` in the `Author`'s model.
Is it possible?
- duplicates
-
MONGOID-4671 Support scope on associations
- Closed