Class DocumentController
In: app/controllers/document_controller.rb
Parent: ApplicationController

************************************************************************/

  • SOLUNAS BOOKING ENGINE */
  • ====================== */
  • */
  • Copyright © 2006 by Marc Isemann */
  • sourceforge.net/projects/solunas */
  • */
  • This program is free software. You can redistribute it and/or modify */
  • it under the terms of the GNU General Public License as published by */
  • the Free Software Foundation; either version 2 of the License. */

************************************************************************/

Methods

create   destroy   edit   index   list   new   print   show   update  

Public Instance methods

[Source]

    # File app/controllers/document_controller.rb, line 41
41:   def create
42:     @document = Document.new(params[:document])
43:     @document.user_id = session[:user_id]
44:     if @document.save
45:       flash[:notice] = 'Document was successfully created.'
46:       redirect_to :action => 'list'
47:     else
48:       render :action => 'new'
49:     end
50:   end

[Source]

    # File app/controllers/document_controller.rb, line 67
67:   def destroy
68:     Document.find(params[:id]).destroy
69:     redirect_to :action => 'list'
70:   end

[Source]

    # File app/controllers/document_controller.rb, line 52
52:   def edit
53:     @document = Document.find(params[:id])
54:   end

[Source]

    # File app/controllers/document_controller.rb, line 20
20:   def index
21:     list
22:     render :action => 'list'
23:   end

[Source]

    # File app/controllers/document_controller.rb, line 29
29:   def list
30:     @document_pages, @documents = paginate :documents, :per_page => 10
31:   end

[Source]

    # File app/controllers/document_controller.rb, line 37
37:   def new
38:     @document = Document.new
39:   end

[Source]

    # File app/controllers/document_controller.rb, line 72
72:   def print
73:   @tester = "Max"
74:   @contract = Contract.find(params[:contract_id])
75:   @document = Document.find(params[:id])
76:   render :inline => @document.rhtml
77: 
78:   end

[Source]

    # File app/controllers/document_controller.rb, line 33
33:   def show
34:     @document = Document.find(params[:id])
35:   end

[Source]

    # File app/controllers/document_controller.rb, line 56
56:   def update
57:     @document = Document.find(params[:id])
58: 
59:     if @document.update_attributes(params[:document])
60:       flash[:notice] = 'Document was successfully updated.'
61:       redirect_to :action => 'show', :id => @document
62:     else
63:       render :action => 'edit'
64:     end
65:   end

[Validate]