Class: UsersController

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

Overview

Managing users

Instance Method Summary collapse

Instance Method Details

#checkObject

post /users/check



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

def check
  @entity = User.new(creation_parameters)
end

#createObject

post /users



21
22
23
24
25
26
27
28
# File 'app/controllers/users_controller.rb', line 21

def create
  @entity = User.new(creation_parameters)
  if @entity.save
    form_processed_ok(admin_user_path(id: @entity.id))
  else
    form_processed_with_error(:new)
  end
end

#destroyObject

delete /users/:id



44
45
46
47
48
# File 'app/controllers/users_controller.rb', line 44

def destroy
  flash[:notice] = t('users.destroy.success') if @entity.destroy #update(deleted: true)

  redirect_to admin_users_path
end

#editObject

get /users/:id/edit



31
32
# File 'app/controllers/users_controller.rb', line 31

def edit
end

#newObject

get /users/new



16
17
18
# File 'app/controllers/users_controller.rb', line 16

def new
  @entity = User.new(consent: true)
end

#updateObject

patch /users/:id



35
36
37
38
39
40
41
# File 'app/controllers/users_controller.rb', line 35

def update
  if @entity.update(entity_parameters)
    form_processed_ok(admin_user_path(id: @entity.id))
  else
    form_processed_with_error(:edit)
  end
end