Module: Compo::Mixins::Movable
- Included in:
- Branches::Branch
- Defined in:
- lib/compo/mixins/movable.rb
Overview
Helper mixin for objects that can be moved into other objects
This mixin defines a method, #move_to, which handles removing a child from its current parent and adding it to a new one.
It expects the current parent to be reachable from #parent.
Instance Method Summary collapse
-
#move_to(new_parent, new_id) ⇒ self
Moves this model object to a new parent with a new ID.
Instance Method Details
#move_to(new_parent, new_id) ⇒ self
Moves this model object to a new parent with a new ID
25 26 27 28 29 |
# File 'lib/compo/mixins/movable.rb', line 25 def move_to(new_parent, new_id) move_from_old_parent move_to_new_parent(new_parent, new_id) self end |