Class: UsersController

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

Instance Method Summary collapse

Instance Method Details

#checkObject

post /users/check



8
9
10
# File 'app/controllers/users_controller.rb', line 8

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

#createObject

post /users



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

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



41
42
43
44
45
46
# File 'app/controllers/users_controller.rb', line 41

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

#editObject

get /users/:id/edit



28
29
# File 'app/controllers/users_controller.rb', line 28

def edit
end

#newObject

get /users/new



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

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

#updateObject

patch /users/:id



32
33
34
35
36
37
38
# File 'app/controllers/users_controller.rb', line 32

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