Class: TalkingStick::ParticipantsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/talking_stick/participants_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_locale

Instance Method Details

#createObject

POST /participants



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/talking_stick/participants_controller.rb', line 27

def create
  params = participant_params.merge ip: request.remote_ip
  @participant = Participant.new(params)
  @participant.room = @room

  respond_to do |format|
    if @participant.save
      format.json { render json: @participant }
    else
      render :new
    end
  end
end

#destroyObject

DELETE /participants/1



51
52
53
54
# File 'app/controllers/talking_stick/participants_controller.rb', line 51

def destroy
  @participant.destroy
  redirect_to talking_stick.room_path(@room), notice: 'Participant was successfully destroyed.'
end

#editObject

GET /participants/1/edit



23
24
# File 'app/controllers/talking_stick/participants_controller.rb', line 23

def edit
end

#indexObject

GET /participants



9
10
11
# File 'app/controllers/talking_stick/participants_controller.rb', line 9

def index
  @participants = Participant.all
end

#newObject

GET /participants/new



18
19
20
# File 'app/controllers/talking_stick/participants_controller.rb', line 18

def new
  @participant = Participant.new
end

#showObject

GET /participants/1



14
15
# File 'app/controllers/talking_stick/participants_controller.rb', line 14

def show
end

#updateObject

PATCH/PUT /participants/1



42
43
44
45
46
47
48
# File 'app/controllers/talking_stick/participants_controller.rb', line 42

def update
  if @participant.update(participant_params)
    redirect_to talking_stick.room_path(@room), notice: 'Participant was successfully updated.'
  else
    render :edit
  end
end