Skip to content
Snippets Groups Projects

Drop default ORDER scope when calling a find method on a Sortable model

Merged Douwe Maan requested to merge dm-drop-default-scope-on-sortable-finders into master
All threads resolved!

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Yorick Peterse
  • assigned to @DouweM

  • @DouweM I added some small comments, and there are a whole bunch of test failures.

  • Author Contributor

    @yorickpeterse Those test failures seemed to just be CI failing for unrelated reasons. Let me see if this new push will do better.

  • Douwe Maan added 1 commit

    added 1 commit

    • 24cc7c19 - Drop default ORDER scope when calling a find method on a Sortable model

    Compare with previous version

  • @DouweM Stuff like this definitely seems suspicious:

     6) GlobalMilestone#initialize has all project milestones with the same title
         Failure/Error: original_impl.bind(unordered_relation).call(*args)
    
         ActiveRecord::RecordNotFound:
           Couldn't find Milestone without an ID
         # ./app/models/concerns/sortable.rb:20:in `call'
         # ./app/models/concerns/sortable.rb:20:in `block (2 levels) in <module:DropDefaultScopeOnFinders>'
         # ./app/models/global_milestone.rb:57:in `initialize'
         # ./spec/models/global_milestone_spec.rb:144:in `new'
         # ./spec/models/global_milestone_spec.rb:144:in `block (3 levels) in <top (required)>'
         # ./spec/spec_helper.rb:90:in `block (2 levels) in <top (required)>'
  • assigned to @DouweM

  • Douwe Maan added 1 commit

    added 1 commit

    • 4d6ee98d - Drop default ORDER scope when calling a find method on a Sortable model

    Compare with previous version

  • Author Contributor

    @yorickpeterse Ah yeah, I didn't realize Relation#find could also take a block to function as regular old Array#find!

  • Author Contributor

    And we went green :D

    @rspeicher Would you be interested in merging this?

  • assigned to @rspeicher

  • @DouweM Clever! LGTM. 👍

  • Douwe Maan resolved all discussions

    resolved all discussions

  • Douwe Maan added 1 commit

    added 1 commit

    • b9ec3f23 - Make changelog more descriptive

    Compare with previous version

  • Douwe Maan added 1 commit

    added 1 commit

    • b9ec3f23 - Make changelog more descriptive

    Compare with previous version

  • Robert Speicher changed milestone to %9.4

    changed milestone to %9.4

  • Robert Speicher approved this merge request

    approved this merge request

  • Robert Speicher mentioned in commit b07c0003

    mentioned in commit b07c0003

  • This merge request introduced a bug which was caught by a failing test on master - https://gitlab.com/gitlab-org/gitlab-ce/issues/34511

  • This test actually failed in the last pipeline executed for this merge request, but then it was retried and it passed 🤔 See https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/20404223.

  • Adam Niedzielski mentioned in merge request !12557 (merged)

    mentioned in merge request !12557 (merged)

  • mentioned in issue #34511 (closed)

  • Douwe Maan mentioned in merge request !12560 (merged)

    mentioned in merge request !12560 (merged)

  • Douwe Maan mentioned in merge request !12633 (merged)

    mentioned in merge request !12633 (merged)

  • mentioned in issue #23079 (closed)

  • Please register or sign in to reply
    Loading