Class: EngineRoom::UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/engine_room/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/engine_room/users_controller.rb', line 23

def create
  @user = User.new(params[:user])
  if @user.save
    flash[:notice] = 'User was successfully created.'
    redirect_to :action => :index
  else
    @user.clean_up_passwords
    add_crumb("Create User")
    render :action => :new
  end
end

#destroyObject



55
56
57
58
59
60
61
# File 'app/controllers/engine_room/users_controller.rb', line 55

def destroy
  @user = User.find(params[:id])
  @user.destroy

  flash[:notice] = 'User was successfully deleted.'
  redirect_to :action => :index
end

#destroy_current_userObject



63
64
65
66
67
68
# File 'app/controllers/engine_room/users_controller.rb', line 63

def destroy_current_user
  @user = current_user
  @user.destroy

  redirect_to destroy_er_devise_user_session_url
end

#editObject



35
36
37
38
# File 'app/controllers/engine_room/users_controller.rb', line 35

def edit
  @user = User.find(params[:id])
  add_crumb("Edit User")
end

#edit_current_userObject



40
41
42
43
# File 'app/controllers/engine_room/users_controller.rb', line 40

def edit_current_user
  @user = current_user
  render :edit
end

#indexObject

GET /users



13
14
15
16
# File 'app/controllers/engine_room/users_controller.rb', line 13

def index
  @users = User.order('username ASC')
  # index.html.erb
end

#newObject



18
19
20
21
# File 'app/controllers/engine_room/users_controller.rb', line 18

def new
  @user = User.new
  add_crumb("Create User")
end

#updateObject



45
46
47
48
# File 'app/controllers/engine_room/users_controller.rb', line 45

def update
  @user = User.find(params[:id])
  update_user
end

#update_current_userObject



50
51
52
53
# File 'app/controllers/engine_room/users_controller.rb', line 50

def update_current_user
  @user = current_user
  update_user
end