Class: Protege::PersonasController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Protege::PersonasController
- 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
-
#create ⇒ void
Create a persona from the form's split email fields.
-
#destroy ⇒ void
Permanently delete a persona and everything it owns.
-
#edit ⇒ void
Render the form for editing a persona.
-
#index ⇒ void
List every persona.
-
#new ⇒ void
Render the form for creating a persona.
-
#show ⇒ void
Show a single persona.
-
#update ⇒ void
Update an existing persona.
Instance Method Details
#create ⇒ void
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 |
#destroy ⇒ void
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 |
#edit ⇒ void
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 |
#index ⇒ void
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 |
#new ⇒ void
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 |
#show ⇒ void
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 |
#update ⇒ void
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 |