Class: ThinkFeelDoEngine::Coach::SentMessagesController

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

Overview

Enables viewing of an individual message sent by coaches.

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

#showObject



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

def show
  @sent_message = current_user.sent_messages.find(params[:id])
  authorize! :show, @sent_message
  render(
    template: "think_feel_do_engine/messages/show",
    locals: {
      message: @sent_message,
      compose_path: new_coach_group_message_path(@group)
    }
  )

rescue ActiveRecord::RecordNotFound
  redirect_to coach_group_messages_url(@group),
              alert: "Unable to find Message with id #{params[:id]}"
end