Method: Inkling::PathsController#update_tree

Defined in:
app/controllers/inkling/paths_controller.rb

#update_treeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/inkling/paths_controller.rb', line 12

def update_tree 
  new_parent_id = params[:new_parent]
  child_id = params[:child]
  new_parent = Inkling::Path.find(new_parent_id)
  child = Inkling::Path.find(child_id)
  restriction = new_parent.restricts?(child)
  if restriction[0]
    @msg = restriction[1]
  else
    child.move_to_child_of new_parent
    child.save
    @msg = "Ok."
  end
end