Class: Api::Admin::BaseController

Inherits:
ActionController::API
  • Object
show all
Includes:
Concerns::Authentication, ElasticApmContext, LogrageCustomLogger
Defined in:
app/controllers/api/admin/base_controller.rb

Direct Known Subclasses

RestaurantsController

Instance Method Summary collapse

Methods included from LogrageCustomLogger

#append_info_to_payload

Instance Method Details

#identity_cache_memoization(&block) ⇒ Object



21
22
23
# File 'app/controllers/api/admin/base_controller.rb', line 21

def identity_cache_memoization(&block)
  IdentityCache.cache.with_memoization(&block)
end

#set_app_language(&action) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/api/admin/base_controller.rb', line 25

def set_app_language(&action)
  lang_header = 'X-HH-Language'
  lang = request.headers[lang_header] || request.headers[lang_header.downcase]
  if lang
    locale = MyLocaleManager.parse(lang)
    I18n.with_locale(locale) do
      Globalize.with_locale(locale, &action)
    end
  else
    yield
  end
  true
end