42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/simple_nested_set/nested_set.rb', line 42
def save!
attributes = node.instance_variable_get(:@_nested_set_attributes) || {}
node.instance_variable_set(:@_nested_set_attributes, nil)
attributes.merge!(:parent_id => node.parent_id) if node.parent_id_changed?
if self.class.move_after_save
move_by_attributes(attributes) unless attributes.blank?
denormalize!
elsif attributes
attributes.except(:parent_id).each do |key, value|
node.update_attribute(key, value)
end
end
end
|