Class: LesliShield::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lesli_shield/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /sessions



31
32
33
34
35
36
37
38
39
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 31

def create
  @session = Session.new(session_params)

  if @session.save
    redirect_to @session, notice: "Session was successfully created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject

DELETE /sessions/1



51
52
53
54
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 51

def destroy
  @session.destroy!
  redirect_to sessions_path, notice: "Session was successfully destroyed.", status: :see_other
end

#editObject

GET /sessions/1/edit



27
28
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 27

def edit
end

#indexObject

GET /sessions



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 6

def index
    respond_to do |format|
        format.html {
            @sessions = respond_as_pagination(Lesli::User::SessionService.new(current_user, query).index())
        }
        format.json { 
            respond_with_pagination(UserSessionService.new(current_user, query).index())
        }
    end
end

#newObject

GET /sessions/new



22
23
24
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 22

def new
  @session = Session.new
end

#showObject

GET /sessions/1



18
19
# File 'app/controllers/lesli_shield/sessions_controller.rb', line 18

def show
end

#updateObject

PATCH/PUT /sessions/1



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

def update
  if @session.update(session_params)
    redirect_to @session, notice: "Session was successfully updated.", status: :see_other
  else
    render :edit, status: :unprocessable_entity
  end
end