Class: ThinkFeelDoEngine::Coach::MembershipsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/think_feel_do_engine/coach/memberships_controller.rb

Overview

Manage Participant Activities.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI

Instance Method Summary collapse

Methods inherited from ApplicationController

#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found

Instance Method Details

#updateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/think_feel_do_engine/coach/memberships_controller.rb', line 11

def update
  authorize! :update, @membership
  if @membership.update(membership_params)
    redirect_to coach_group_patient_dashboards_path(@group),
                notice: "Participant was successfully stepped."
  else
    redirect_to(
      coach_group_patient_dashboards_path(@group),
      alert: @membership.errors.full_messages.join(", ") +
             "End date cannot be set prior to tomorrow's date. "\
             "Please use [Discontinue] or [Terminate Access]."
    )
  end
end