Module: DataMapper::Is::NestedSet::InstanceMethods
Public Visibility
Public Instance Method Summary
| #move(vector) |
move self / node to a position in the set. Returns: |
|---|---|
| #move_without_saving(vector) |
does all the actual movement in #move, but does not save afterwards. |
| #reload_position |
reloads the left and right attributes for self. |
Public Instance Method Details
move
public
move(vector)
move self / node to a position in the set. position can only be changed through this
[View source]
141 142 143 144
# File 'dm-more/dm-is-nested_set/lib/dm-is-nested_set/is/nested_set.rb', line 141 def move(vector) move_without_saving(vector) save end
move_without_saving
public
move_without_saving(vector)
does all the actual movement in #move, but does not save afterwards. this is used internally in before :save, and will probably be marked private. should not be used by organic beings.
[View source]
151 152
# File 'dm-more/dm-is-nested_set/lib/dm-is-nested_set/is/nested_set.rb', line 151 def move_without_saving(vector) if vector.is_a? Hash then action,object = vector.keys[0],vector.values[0] else action = vector end
reload_position
public
reload_position
reloads the left and right attributes for self. if #move did not use this, we’d get quite peculiar results, and most likely corrupt the nested sets pretty fast.
[View source]
111 112 113 114 115 116 117
# File 'dm-more/dm-is-nested_set/lib/dm-is-nested_set/is/nested_set.rb', line 111 def reload_position self.reload_attributes(:lft,:rgt) end