DBServer/app/models/page.rb
## add new page to a document
add new page to a document
add new page to a document
def add_to_document(document, position=document.page_count-1)
    self.transaction do
      old_document_id=self.document_id
      self.document_id=document.id
      self.position=position
      self.save!
      self.document.update_after_page_change
      Document.find(old_document_id).destroy unless old_document_id.nil?
    end
  end
def add_to_document ( document , position = document . page_count - 1 ) self . transaction do old_document_id = self . document_id self . document_id = document . id self . position = position self . save! self . document . update_after_page_change Document . find ( old_document_id ) . destroy unless old_document_id . nil? end end
add new page to a document
add new page to a document
document
<not_specific>
position
<not_specific>
page_count
<not_specific>