Class: ThinkFeelDoEngine::Participants::AssessmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ThinkFeelDoEngine::Participants::AssessmentsController
- Defined in:
- app/controllers/think_feel_do_engine/participants/assessments_controller.rb
Overview
Authorizes and manages Assessment administration.
Constant Summary collapse
- ASSESSMENT_TYPES =
{ phq9: PhqAssessment, wai: WaiAssessment }
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
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/think_feel_do_engine/participants/assessments_controller.rb', line 18 def create @assessment = build_assessment(assessment_params) if @assessment.save flash.now[:notice] = "Assessment saved" if available_token @token = available_token @assessment = build_assessment(release_date: @token.release_date) render "think_feel_do_engine/participants/assessments/" \ "new_#{ assessment_name }" else render :success end else errors = @assessment.errors..join(", ") flash.now[:alert] = "Unable to save assessment: #{ errors }" render "think_feel_do_engine/participants/assessments/" \ "new_#{ assessment_name }" end end |
#new ⇒ Object
11 12 13 14 15 16 |
# File 'app/controllers/think_feel_do_engine/participants/assessments_controller.rb', line 11 def new @assessment = build_assessment(release_date: @token.release_date) render "think_feel_do_engine/participants/assessments/" \ "new_#{ assessment_name }" end |