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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/rsvp/session_controller.rb', line 12

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
    if exceeded_access_attempts?
      redirect_when_locked
    else
      flash.alert = "Oops!! The code you entered is not valid. Please try again."
      redirect_to root_path
    end
  end
end

#destroyObject

DELETE /session



28
29
30
31
# File 'app/controllers/rsvp/session_controller.rb', line 28

def destroy
  session[:invitation_id] = nil
  redirect_after_destroy
end

#indexObject

GET /session



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

def index; end