module Mongoid::Orderable::Mixins::Movable

Public Instance Methods

insert_at(target_position, options = {})
Alias for: move_to
insert_at!(target_position, options = {})
Alias for: move_to!
insert_at=(target_position, options = {})
Alias for: move_to=
move_to(target_position, options = {}) click to toggle source
# File lib/mongoid/orderable/mixins/movable.rb, line 13
def move_to(target_position, options = {})
  move_field_to target_position, options
end
Also aliased as: insert_at
move_to!(target_position, options = {}) click to toggle source
# File lib/mongoid/orderable/mixins/movable.rb, line 7
def move_to!(target_position, options = {})
  move_field_to target_position, options
  save
end
Also aliased as: insert_at!
move_to=(target_position, options = {}) click to toggle source
# File lib/mongoid/orderable/mixins/movable.rb, line 18
def move_to=(target_position, options = {})
  move_field_to target_position, options
end
Also aliased as: insert_at=

Protected Instance Methods

move_all() click to toggle source
# File lib/mongoid/orderable/mixins/movable.rb, line 49
def move_all
  @move_all || {}
end
move_field_to(position, options) click to toggle source
# File lib/mongoid/orderable/mixins/movable.rb, line 53
def move_field_to(position, options)
  field = options[:field] || default_orderable_field
  @move_all = move_all.merge(field => position)
end