Class: Auth::Admin::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/auth/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
# File 'app/controllers/auth/admin/users_controller.rb', line 12

def create
  @user = User.new(user_params)
  if @user.join(params)
    redirect_to admin_users_url, notice: 'User was successfully created.'
  else
    render :new
  end
end

#destroyObject



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

def destroy
  @user.destroy
  redirect_to admin_users_url, alert: 'User was successfully destroyed.'
end

#editObject



24
25
26
# File 'app/controllers/auth/admin/users_controller.rb', line 24

def edit

end

#indexObject



4
5
6
# File 'app/controllers/auth/admin/users_controller.rb', line 4

def index
  @users = User.includes(:oauth_users).order(created_at: :desc).default_where(search_params).page(params[:page])
end

#newObject



8
9
10
# File 'app/controllers/auth/admin/users_controller.rb', line 8

def new
  @user = User.new
end

#showObject



21
22
# File 'app/controllers/auth/admin/users_controller.rb', line 21

def show
end

#updateObject



28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/auth/admin/users_controller.rb', line 28

def update
  respond_to do |format|
    if @user.update(user_params)
      format.js { head :no_content }
      format.html { redirect_to admin_users_url, notice: 'User was successfully updated.' }
    else
      format.js { head :no_content }
      format.html { render :edit }
    end
  end
end