Class: ThinkFeelDoEngine::Participants::MediaAccessEventsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb

Overview

Captures participant use of media.

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

#createObject



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

def create
  @media_access_event = current_participant
                        .media_access_events
                        .build(media_access_event_params)

  if @media_access_event.save
    render json: {
      media_access_event_id: @media_access_event.id,
      status: 201
    }
  else
    head :unprocessable_entity
  end
end

#updateObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb', line 25

def update
  @media_access_event = MediaAccessEvent.find(params[:id])

  if @media_access_event.update(media_access_event_params)
    head :ok
  else
    head :unprocessable_entity
  end
end