Class UserController
In: app/controllers/user_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/user_controller.rb, line 33
33:   def create
34:     @user = User.new(params[:user])
35: 
36:     if @user.save
37:       flash[:notice] = 'User was successfully created.'
38:       redirect_to :action => 'list'
39:     else
40:       render :action => 'new'
41:     end
42:   end

[Source]

    # File app/controllers/user_controller.rb, line 73
73:   def destroy
74:     User.find(params[:id]).destroy
75:     redirect_to :action => 'list'
76:   end

[Source]

    # File app/controllers/user_controller.rb, line 44
44:   def edit
45:     @user = User.find(session[:user_id])
46:   end

[Source]

    # File app/controllers/user_controller.rb, line 16
16:   def index
17:     list
18:     render :action => 'list'
19:   end

[Source]

    # File app/controllers/user_controller.rb, line 21
21:   def list
22:     @user_pages, @users = paginate :users, :per_page => 10
23:   end

[Source]

    # File app/controllers/user_controller.rb, line 29
29:   def new
30:     @user = User.new
31:   end

[Source]

    # File app/controllers/user_controller.rb, line 25
25:   def show
26:     @user = User.find(params[:id])
27:   end

[Source]

    # File app/controllers/user_controller.rb, line 48
48:   def update
49:     @user = User.find(params[:id])
50:     if params[:password] != ""
51:       @user.hashed_password = User.hash_password(params[:password])
52:     end
53:     @user.homepage = params[:user][:homepage]
54:     @user.email = params[:user][:email]
55:     if session[:admin] == 0
56:       @user.datestring = params[:user][:datestring]
57:       @user.currency = params[:user][:currency]
58:       @user.header = params[:user][:header]
59:       @user.footer = params[:user][:footer]
60:       @user.creditcard = params[:user][:creditcard]
61:       @user.language = params[:user][:language]
62: 
63:     end
64: 
65:     if @user.update #_attributes(params[:user])
66:       flash[:notice] = 'User was successfully updated.'
67:       redirect_to :action => 'edit', :id => @user
68:     else
69:       render :action => 'edit'
70:     end
71:   end

[Validate]