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

Mongoid::Criteria#shift should skip current element

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

      I have a scope that I want to take the first element from, then iterate over the rest of its contents.

      I would expect calling #shift would return the current element and skip to the next one in the collection, but it does not skip to the next element.

      describe "#shift" do

      1. PASSES
        it "returns the current value" do
        @person.addresses.criteria.shift.number.should == 1
        end
      1. FAILS
        it "skips to the next value" do
        @person.addresses.criteria.shift
        @person.addresses.criteria.first.number.should == 2
        end

      end

            Assignee:
            Unassigned Unassigned
            Reporter:
            maxhawkins Max Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: