Class: Protege::PersonasController

Inherits:
ApplicationController show all
Defined in:
app/controllers/protege/personas_controller.rb

Overview

Manages persona records — listing, creating, viewing, editing, and permanent deletion.

A persona is the identity behind an inbox; the controller surfaces the full CRUD the dashboard needs. destroy is the hard, irreversible removal (cascading all the persona's data); the reversible, history-preserving alternative is archiving — see ArchivesController.

Instance Method Summary collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Create a persona from the form's split email fields. Serves POST /personas.

On failure, re-render the form with validation errors.



41
42
43
44
45
46
47
48
49
# File 'app/controllers/protege/personas_controller.rb', line 41

def create
  @persona = Persona.new(create_params)

  if @persona.save
    redirect_to persona_path(@persona), notice: 'Persona created.'
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyvoid

This method returns an undefined value.

Permanently delete a persona and everything it owns. Serves DELETE /personas/:id.

This is the hard, irreversible removal (the reversible path is Archive — see ArchivesController): the model cascades the persona's threads, messages, responsibilities, access rules, and tool-use history. BroadcastablePersona removes its sidebar row.



71
72
73
74
75
# File 'app/controllers/protege/personas_controller.rb', line 71

def destroy
  @persona.destroy!

  redirect_to personas_path, notice: 'Persona deleted.'
end

#editvoid

This method returns an undefined value.

Render the form for editing a persona. Serves GET /personas/:id/edit.



34
# File 'app/controllers/protege/personas_controller.rb', line 34

def edit; end

#indexvoid

This method returns an undefined value.

List every persona. Serves GET /personas.



15
16
17
# File 'app/controllers/protege/personas_controller.rb', line 15

def index
  @personas = Persona.all
end

#newvoid

This method returns an undefined value.

Render the form for creating a persona. Serves GET /personas/new.



27
28
29
# File 'app/controllers/protege/personas_controller.rb', line 27

def new
  @persona = Persona.new
end

#showvoid

This method returns an undefined value.

Show a single persona. Serves GET /personas/:id.



22
# File 'app/controllers/protege/personas_controller.rb', line 22

def show; end

#updatevoid

This method returns an undefined value.

Update an existing persona. Serves PATCH /personas/:id.

On failure, re-render the edit form with validation errors.



56
57
58
59
60
61
62
# File 'app/controllers/protege/personas_controller.rb', line 56

def update
  if @persona.update(update_params)
    redirect_to persona_path(@persona), notice: 'Persona updated.'
  else
    render :edit, status: :unprocessable_entity
  end
end