Class: Manage::AdminsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/manage/admins_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#limit_admin_access, #logged_in

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
# File 'app/controllers/manage/admins_controller.rb', line 25

def create
  @user = ::User.new(user_params.merge(password: Devise.friendly_token.first(10)))
  if @user.save
    @user.update_attribute(:admin, true)
    @user.send_reset_password_instructions
  end
  respond_with(:manage, @user, location: manage_admins_path)
end

#datatableObject



9
10
11
# File 'app/controllers/manage/admins_controller.rb', line 9

def datatable
  render json: AdminDatatable.new(view_context)
end

#destroyObject



39
40
41
42
# File 'app/controllers/manage/admins_controller.rb', line 39

def destroy
  @user.destroy
  respond_with(:manage, @user, location: manage_admins_path)
end

#editObject



22
23
# File 'app/controllers/manage/admins_controller.rb', line 22

def edit
end

#indexObject



6
7
# File 'app/controllers/manage/admins_controller.rb', line 6

def index
end

#newObject



17
18
19
20
# File 'app/controllers/manage/admins_controller.rb', line 17

def new
  @user = ::User.new
  respond_with(:manage, @user)
end

#showObject



13
14
15
# File 'app/controllers/manage/admins_controller.rb', line 13

def show
  respond_with(:manage, @user)
end

#updateObject



34
35
36
37
# File 'app/controllers/manage/admins_controller.rb', line 34

def update
  @user.update_attributes(user_params)
  respond_with(:manage, @user, location: manage_admins_path)
end