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

Cannot use named scopes on "deleted" paranoid documents

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None

      class Fish
        include Mongoid::Document
        include Mongoid::Paranoia
      
        def self.fresh
          where(:fresh => true)
        end
      end
      
      puts [
        Fish.fresh,
        Fish.unscoped.fresh,
        Fish.deleted.fresh,
        Fish.unscoped.where(:fresh => true),
      ].map(&:selector)
      

      Outputs:

      {:deleted_at=>nil, :fresh=>true}
      {:deleted_at=>nil, :fresh=>true}
      {:deleted_at=>nil, :fresh=>true}
      {:fresh=>true}
      

      I expect the last 3 work the same

            Assignee:
            Unassigned Unassigned
            Reporter:
            semaperepelitsa semaperepelitsa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: