Class: Admin::UsersController

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

Instance Method Summary collapse

Instance Method Details

#ensure_deletableObject



24
25
26
27
28
29
# File 'app/controllers/admin/users_controller.rb', line 24

def ensure_deletable
  if current_user.id.to_s == params[:id].to_s
    announce_cannot_delete_self
    redirect_to admin_users_url
  end
end

#showObject



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

def show
  redirect_to edit_admin_user_path(params[:id])
end

#updateObject



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

def update
  user_params = params[model_symbol]
  if user_params && user_params['admin'] == false && model == current_user
    user_params.delete('admin')
    annouce_cannot_remove_self_from_admin_role
  end
  model.update_attributes!(user_params)
  response_for :update
end