Class: PushType::Admin::UsersController

Inherits:
PushType::AdminController show all
Defined in:
app/controllers/push_type/admin/users_controller.rb

Instance Method Summary collapse

Methods inherited from PushType::AdminController

#info

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/push_type/admin/users_controller.rb', line 16

def create
  if @user.save
    flash[:notice] = 'User successfully created.'
    redirect_to push_type_admin.users_path
  else
    render 'new'
  end
end

#destroyObject



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/push_type/admin/users_controller.rb', line 37

def destroy
  if @user != push_type_user
    @user.destroy
    flash[:notice] = 'User deleted.'
    redirect_to push_type_admin.users_path
  else
    flash[:alert] = 'Trying to delete yourself is the thirty seventh sign of madness.'
    redirect_back fallback_location: push_type_admin.user_path(@user)
  end
end

#editObject



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

def edit
end

#indexObject



9
10
11
# File 'app/controllers/push_type/admin/users_controller.rb', line 9

def index
  @users = user_scope.page(params[:page]).per(30)
end

#newObject



13
14
# File 'app/controllers/push_type/admin/users_controller.rb', line 13

def new
end

#updateObject



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

def update
  if @user.update_attributes user_params
    flash[:notice] = 'User successfully updated.'
    redirect_to push_type_admin.users_path
  else
    render 'edit'
  end
end