Class: Releaf::Content::Node::SaveUnderParent

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/releaf/content/node/save_under_parent.rb

Instance Method Summary collapse

Methods included from Service

#add_error_and_raise

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/releaf/content/node/save_under_parent.rb', line 7

def call
  node.parent_id = parent_id
  if node.validate_root_locale_uniqueness?
    # When copying root nodes it is important to reset locale to nil.
    # Later user should fill in locale. This is needed to prevent
    # Rails errors about conflicting routes.
    node.locale = nil
  end

  node.maintain_name
  node.maintain_slug
  node.save!
end