Class: Rsvp::SessionController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rsvp/session_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /session



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/rsvp/session_controller.rb', line 9

def create
  invitation = Invitation.find_by_rsvp_code(params[:rsvp_code])
  if invitation
    session[:invitation_id] = invitation.id
    redirect_to (invitation.responses.any? ? show_response_index_path : response_index_path)
  else
    flash.alert = "Oops!! The code you entered is not valid. Please try again."
    redirect_to root_path
  end
end

#destroyObject

DELETE /session



21
22
23
24
# File 'app/controllers/rsvp/session_controller.rb', line 21

def destroy
  session[:invitation_id] = nil
  redirect_to root_path, notice: "Thank you for your response!"
end

#indexObject

GET /session



6
# File 'app/controllers/rsvp/session_controller.rb', line 6

def index; end