Class: User::SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/lesli_guard/user/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /user/sessions/1



48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/lesli_guard/user/sessions_controller.rb', line 48

def destroy
    return respond_with_not_found unless @user_session

    if @user_session.delete
        current_user.logs.create({title: "close_session",description: "by_user: " + current_user.email})
        respond_with_successful
    else
        respond_with_error(@user_session.errors.full_messages.to_sentence)
    end
end

#indexObject

GET /user/sessions



38
39
40
41
42
43
44
45
# File 'app/controllers/lesli_guard/user/sessions_controller.rb', line 38

def index
    respond_to do |format|
        format.html {}
        format.json do
            return respond_with_pagination(UserService.new(current_user, query).sessions(session[:user_session_id]))
        end
    end
end