Class: Api::BaseController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/generators/petergate_api/templates/app/controllers/api/base_controller.rb

Direct Known Subclasses

V1::AuthController

Instance Method Summary collapse

Instance Method Details

#current_userObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/petergate_api/templates/app/controllers/api/base_controller.rb', line 4

def current_user
  @user ||= begin
              if request.headers["Authorization"] 
                # you might want to check redis or memcache to for cache invalidation
                ::ApiUser.new(request.headers["Authorization"])
              else
                nil
              end
            end
end