Class NoteController
In: app/controllers/note_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   show   update  

Public Instance methods

[Source]

    # File app/controllers/note_controller.rb, line 37
37:   def create
38:     @note = Note.new(params[:note])
39:     @note.customer_id = params[:customer_id]
40:     @note.user_id = session[:user_id]
41:     if @note.save
42:       flash[:notice] = 'Note was successfully created.'
43:       redirect_to(:action => 'show', :controller => 'customer', :id => params[:customer_id])
44:     else
45:       render :action => 'new'
46:     end
47:   end

[Source]

    # File app/controllers/note_controller.rb, line 63
63:   def destroy
64:     Note.find(params[:id]).destroy
65:     redirect_to(:action => 'list', :customer_id => params[:customer_id])
66:   end

[Source]

    # File app/controllers/note_controller.rb, line 49
49:   def edit
50:     @note = Note.find(params[:id])
51:   end

[Source]

    # File app/controllers/note_controller.rb, line 18
18:   def index
19:     list
20:     render :action => 'list'
21:   end

[Source]

    # File app/controllers/note_controller.rb, line 23
23:   def list
24:     @customer = Customer.find(params[:customer_id])
25:     @note_pages, @notes = paginate :notes, :per_page => 10, :conditions => ["user_id = ? && customer_id = ?",session[:user_id], params[:customer_id]]
26:   end

[Source]

    # File app/controllers/note_controller.rb, line 32
32:   def new
33:     @note = Note.new
34:     @customer = Customer.find(params[:customer_id])
35:   end

[Source]

    # File app/controllers/note_controller.rb, line 28
28:   def show
29:     @note = Note.find(params[:id])
30:   end

[Source]

    # File app/controllers/note_controller.rb, line 53
53:   def update
54:     @note = Note.find(params[:id])
55:     if @note.update_attributes(params[:note])
56:       flash[:notice] = 'Note was successfully updated.'
57:       redirect_to :action => 'show', :id => @note
58:     else
59:       render :action => 'edit'
60:     end
61:   end

[Validate]