simi / mongoid_paranoia

Paranoid Documents for Mongoid 7
MIT License
121 stars 60 forks source link

Define a scope on a relation #33

Open Elyasin opened 9 years ago

Elyasin commented 9 years ago

Hi there, I was wondering whether and/or how it is possible to define a scope to include soft deleted objects in a relation. For example, inspired by ActiveRecord, I am looking for something like this:

has_and_belongs_to_many :users, -> { unscoped }

Would appreciate any help. Also, in case it is not possible or no viable workaround exists, I could maybe develope that feature myself. However, I will need guidance, I am not to proficient in Ruby yet.

Any helpers? Any takers?

johnnyshields commented 3 years ago

👍 I have this exact same problem and thinking of making a version of this gem which removes all default scopes.