API endpoint for retrieving the current user

This commit is contained in:
Robin Ward
2014-02-05 13:46:24 -05:00
parent af5254d3b4
commit 1dac3cfd64
3 changed files with 29 additions and 0 deletions

View File

@ -55,6 +55,14 @@ class SessionController < ApplicationController
render json: {result: "ok"}
end
def current
if current_user.present?
render_serialized(current_user, CurrentUserSerializer)
else
render nothing: true, status: 404
end
end
def destroy
reset_session
log_off_user