Class: ThinkFeelDoEngine::Coach::MessagesController
Overview
Manages coach message handling.
Constant Summary
ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI
Instance Method Summary
collapse
#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for
Instance Method Details
#create ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'app/controllers/think_feel_do_engine/coach/messages_controller.rb', line 35
def create
authorize! :create, Message
@message = current_user.build_sent_message(message_params)
if @message.save
redirect_to coach_group_messages_url(@group), notice: "Message saved"
else
errors = @message.errors.full_messages.join(", ")
redirect_to :back, alert: "Unable to save message: #{ errors }"
end
end
|
#index ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/think_feel_do_engine/coach/messages_controller.rb', line 9
def index
authorize! :show, Message
@participants = grouped_assigned_participants
render(
locals: {
received_messages: received_messages,
sent_messages: sent_messages
}
)
end
|
#new ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/think_feel_do_engine/coach/messages_controller.rb', line 22
def new
authorize! :new, Message
@new_message = current_user.build_sent_message
render(
locals: {
message: message_for_reply,
participants: grouped_assigned_participants
}
)
end
|
#reply ⇒ Object
46
47
48
|
# File 'app/controllers/think_feel_do_engine/coach/messages_controller.rb', line 46
def reply
authorize! :create, Message
end
|