Default scopes apply to other scopes

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hey Durran. I just noticed that a model's default scope will be applied if you use unscoped and then a scope. Eg:

      class Porkchop
        include Mongoid::Document
      
        default_scope where(:default => true)
      
        scope :tasty, where(:tasty => true)
      end
      
      Porkchop.unscoped.tasty
      => #<Mongoid::Criteria
        selector: {:default=>true, :tasty=>true},
        options:  {},
        class:    Porkchop,
        embedded: false>
      

      I'd expect Porkchop.unscoped.tasty not to contain the default scope.

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

                Created:
                Updated:
                Resolved: