Class: Angarium::Api::BaseController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/angarium/api/base_controller.rb

Overview

Base controller for the headless JSON API. Inherits from your app's controller (config.parent_controller, default "ApplicationController"), so your existing authentication applies here too.

Instance Method Summary collapse

Instance Method Details

#angarium_current_userObject

Resolved current user (via config.current_user). Public so policies can read it as controller.angarium_current_user.



21
22
23
24
25
# File 'app/controllers/angarium/api/base_controller.rb', line 21

def angarium_current_user
  return @angarium_current_user if defined?(@angarium_current_user)

  @angarium_current_user = Angarium.config.current_user.call(self)
end