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

Ensure that .sort method change criteria

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

      This is not working on the latest version of mongoid:

       UserThemeVersion.where(parent_id: theme.id, user: current_user.id).sort(version: -1).first
      

      it was ignoring the sort on the first query.

      This pull request fix that issue. and also:

      1- .sort method was not changing the criteria, so when .first applied it assumed there was no sort and it was ignoring it

      2 - making apply_sorting a block function to unsure it will reset the query after execution of .first or .last

            Assignee:
            Unassigned Unassigned
            Reporter:
            arthurnn Arthur Nogueira Neves
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: