Module: Qbrick::PageTree

Extended by:
PageTree
Included in:
PageTree
Defined in:
lib/qbrick/page_tree.rb

Instance Method Summary collapse

Instance Method Details

#update(params, parent_id = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/qbrick/page_tree.rb', line 5

def update(params, parent_id = nil)
  params.each do |page_position, page_content|
    page = Page.find(page_content['id'])
    page.update_attributes(parent_id: parent_id, position: page_position)
    next if page_content['children'].nil?
    update(page_content['children'], page.id)
  end
end