Skip to content

BUG: I can't add item in the middle of the list. #78

@gotoinc

Description

@gotoinc

Seems like a bug. Or no functionaly for that. Or i do smth wrong.
Steps to reproduce.
``1. rails c

Model

class Test
  ### INCLUDES AND EXTENDS
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Orderable

  orderable field: :position

  ### Fields
  field :rate, type: Integer
  field :position,   type: Integer
end
Test.create!(rate: 80)
Test.create!(rate: 70)
Test.create!(rate: 60)

# Bug
Test.create!(rate: 30, position: 2)
Responce
#<Test _id: 64db673bc9876f69e0f19c91, created_at: 2023-08-15 11:53:27 UTC, updated_at: 2023-08-15 11:53:27 UTC, position: 4, rate: 30>

Help me or I write this functionality by myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions