DBServer/app/models/page.rb
## remove from document and create a new document
remove from document and create a new document
remove from document and create a new document
def move_to_new_document
    position=self.position
    old_document=self.document
    Page.transaction do
      doc=Document.new(:status => Document::DOCUMENT_FROM_PAGE_REMOVED, :page_count => 1, :folder_id => old_document.folder_id)
      doc.save!
      self.document_id=doc.id
      self.position=0
      self.save!
      CleanPositionsOnRemove(old_document.id, position)
      old_document.update_after_page_change
    end
  end
def move_to_new_document position = self . position old_document = self . document Page . transaction do doc = Document . new ( :status => Document :: DOCUMENT_FROM_PAGE_REMOVED , :page_count => 1 , :folder_id => old_document . folder_id ) doc . save! self . document_id = doc . id self . position = 0 self . save! CleanPositionsOnRemove ( old_document . id , position ) old_document . update_after_page_change end end
remove from document and create a new document
remove from document and create a new document
## save all values