Class: Admin::UsersController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Admin::UsersController
- Defined in:
- app/controllers/admin/users_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from BaseHelper
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/admin/users_controller.rb', line 19 def create @user = User.new(params[:user]) @user.set_roles(params[:roles]) if @user.save redirect_to admin_users_path else render :new end end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/controllers/admin/users_controller.rb', line 46 def destroy @user = User.find(params[:id]) @user.destroy redirect_to admin_users_path end |
#edit ⇒ Object
31 32 33 |
# File 'app/controllers/admin/users_controller.rb', line 31 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/admin/users_controller.rb', line 11 def index @users = User.order(:email).page(params[:page]) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/admin/users_controller.rb', line 15 def new @user = User.new end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/admin/users_controller.rb', line 35 def update @user = User.find(params[:id]) @user.set_roles(params[:roles]) if @user.update_attributes(params[:user]) redirect_to admin_users_path else render :edit end end |