Sha256: 56b8a6ef91cd70285e4cc4437c83826081d8e921bbac22e9dd76ca47e0a97232

Contents?: true

Size: 929 Bytes

Versions: 7

Compression:

Stored size: 929 Bytes

Contents

module MessageTrain
  class ParticipantsController < MessageTrain::ApplicationController
    before_filter :load_participants
    before_filter :load_participant, only: :show

    # GET /box/in/participants
    def index
      respond_to do |format|
        format.json { render :index }
      end
    end

    # GET /box/in/participants/1
    def show
      respond_to do |format|
        format.json { render :show }
      end
    end

    private

      def load_participants
        current_participant = send(MessageTrain.configuration.current_user_method)
        method = MessageTrain.configuration.address_book_method
        if current_participant.respond_to? method
          @participants = current_participant.send(method)
        else
          @participants = current_participant.class.all
        end
      end

      def load_participant
        @participant = @participants.find(params[:id])
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
message_train-0.1.6 app/controllers/message_train/participants_controller.rb
message_train-0.1.5 app/controllers/message_train/participants_controller.rb
message_train-0.1.4 app/controllers/message_train/participants_controller.rb
message_train-0.1.3 app/controllers/message_train/participants_controller.rb
message_train-0.1.2 app/controllers/message_train/participants_controller.rb
message_train-0.1.1 app/controllers/message_train/participants_controller.rb
message_train-0.1.0 app/controllers/message_train/participants_controller.rb