Class: Backend::AdminsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/backend/admins_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#breadcrumb, #current_admin, #default_app_locale, #translate_notice

Methods included from Udongo::Cryptography

#crypt

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/backend/admins_controller.rb', line 17

def create
  @admin = Admin.new allowed_params

  if @admin.save
    redirect_to backend_admins_path, notice: translate_notice(:added, :admin)
  else
    render :new
  end
end

#destroyObject



35
36
37
38
# File 'app/controllers/backend/admins_controller.rb', line 35

def destroy
  @admin.destroy
  redirect_to backend_admins_path, notice: translate_notice(:deleted, :admin)
end

#indexObject



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

def index
  @admins = Admin.all
end

#newObject



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

def new
  @admin = Admin.new
end

#showObject



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

def show
  redirect_to edit_backend_admin_path(@admin)
end

#updateObject



27
28
29
30
31
32
33
# File 'app/controllers/backend/admins_controller.rb', line 27

def update
  if @admin.update_attributes allowed_params
    redirect_to backend_admins_path, notice: translate_notice(:changes_saved)
  else
    render :edit
  end
end