getschomp/commute-calculator-api

View on GitHub
app/controllers/application_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class ApplicationController < ActionController::API
  before_action :authenticate_request
  attr_reader :current_user

  private

   def authenticate_request
     @current_user = Services::RequestAuthorizor.new(request.headers).call
     render json: { error: 'Not Authorized' }, status: 401 unless @current_user
   end
end