Sha256: 00a4bf6f8dc9719cb52948545e3836b25fadbccb8a2458febc47792c334a599a

Contents?: true

Size: 712 Bytes

Versions: 5

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true
require_dependency "social_networking/application_controller"

module SocialNetworking
  # Manage Participants.
  class ParticipantsController < ApplicationController
    rescue_from ActiveRecord::RecordNotFound, with: :record_not_found

    def index
      participants = Participant.all

      render json: Serializers::ParticipantSerializer
        .from_collection(participants)
    end

    def show
      participant = Participant.find(params[:id])

      render json: Serializers::ParticipantSerializer.new(participant)
        .to_serialized
    end

    private

    def record_not_found
      render json: { error: "participant not found" }, status: 404
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 app/controllers/social_networking/participants_controller.rb
social_networking-0.13.2 app/controllers/social_networking/participants_controller.rb
social_networking-0.13.1 app/controllers/social_networking/participants_controller.rb
social_networking-0.13.0 app/controllers/social_networking/participants_controller.rb
social_networking-0.12.0 app/controllers/social_networking/participants_controller.rb