Class: Protege::ResponsibilitiesController

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

Overview

Manages scheduled responsibilities — the Loop layer's dashboard CRUD. A top-level section (like Personas or Traces): responsibilities are listed across all personas, and each one names its owning persona in the form rather than carrying it in the URL.

Instance Method Summary collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Create a responsibility (its persona is chosen in the form). On failure, re-render with errors.



37
38
39
40
41
42
43
44
45
# File 'app/controllers/protege/responsibilities_controller.rb', line 37

def create
  @responsibility = Responsibility.new(responsibility_params)

  if @responsibility.save
    redirect_to responsibility_path(@responsibility), notice: 'Responsibility created.'
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyvoid

This method returns an undefined value.

Remove a responsibility.



61
62
63
64
# File 'app/controllers/protege/responsibilities_controller.rb', line 61

def destroy
  @responsibility.destroy
  redirect_to responsibilities_path, notice: 'Responsibility deleted.'
end

#editvoid

This method returns an undefined value.

Render the form for editing a responsibility.



32
# File 'app/controllers/protege/responsibilities_controller.rb', line 32

def edit; end

#indexvoid

This method returns an undefined value.

List every responsibility, newest-owner-agnostic (ordered by name via the model's default scope).



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

def index
  @responsibilities = Responsibility.includes(:persona)
end

#newvoid

This method returns an undefined value.

Render the form for creating a responsibility.



25
26
27
# File 'app/controllers/protege/responsibilities_controller.rb', line 25

def new
  @responsibility = Responsibility.new
end

#showvoid

This method returns an undefined value.

Show a single responsibility and its recent runs.



20
# File 'app/controllers/protege/responsibilities_controller.rb', line 20

def show; end

#updatevoid

This method returns an undefined value.

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



50
51
52
53
54
55
56
# File 'app/controllers/protege/responsibilities_controller.rb', line 50

def update
  if @responsibility.update(responsibility_params)
    redirect_to responsibility_path(@responsibility), notice: 'Responsibility updated.'
  else
    render :edit, status: :unprocessable_entity
  end
end