Class: EngineRoom::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- EngineRoom::UsersController
- Defined in:
- app/controllers/engine_room/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #destroy_current_user ⇒ Object
- #edit ⇒ Object
- #edit_current_user ⇒ Object
-
#index ⇒ Object
GET /users.
- #new ⇒ Object
- #update ⇒ Object
- #update_current_user ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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_user ⇒ Object
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 |
#edit ⇒ Object
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_user ⇒ Object
40 41 42 43 |
# File 'app/controllers/engine_room/users_controller.rb', line 40 def edit_current_user @user = current_user render :edit end |
#index ⇒ Object
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 |
#new ⇒ Object
18 19 20 21 |
# File 'app/controllers/engine_room/users_controller.rb', line 18 def new @user = User.new add_crumb("Create User") end |
#update ⇒ Object
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_user ⇒ Object
50 51 52 53 |
# File 'app/controllers/engine_room/users_controller.rb', line 50 def update_current_user @user = current_user update_user end |