Class: Mongoid::Orderable::Handlers::Document
- Inherits:
-
Base
- Object
- Base
- Mongoid::Orderable::Handlers::Document
show all
- Defined in:
- lib/mongoid/orderable/handlers/document.rb
Instance Attribute Summary
Attributes inherited from Base
#doc
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#after_create ⇒ Object
12
13
14
|
# File 'lib/mongoid/orderable/handlers/document.rb', line 12
def after_create
reset
end
|
#after_destroy ⇒ Object
25
26
27
28
|
# File 'lib/mongoid/orderable/handlers/document.rb', line 25
def after_destroy
remove_all_positions
reset
end
|
#after_update ⇒ Object
21
22
23
|
# File 'lib/mongoid/orderable/handlers/document.rb', line 21
def after_update
reset
end
|
#before_create ⇒ Object
7
8
9
10
|
# File 'lib/mongoid/orderable/handlers/document.rb', line 7
def before_create
set_new_record_positions
apply_all_positions
end
|
#before_update ⇒ Object
16
17
18
19
|
# File 'lib/mongoid/orderable/handlers/document.rb', line 16
def before_update
return unless any_field_changed?
apply_all_positions
end
|