Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Foreman::ThreadSession::Cleaner
Defined in:
app/controllers/application_controller.rb

Instance Method Summary collapse

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#api_request?Boolean


33
34
35
# File 'app/controllers/application_controller.rb', line 33

def api_request?
  request.format.json? or request.format.yaml?
end

#welcomeObject


22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/application_controller.rb', line 22

def welcome
  @searchbar = true
  klass = controller_name == "dashboard" ? "Host" : controller_name.camelize.singularize
  if (klass.constantize.first.nil? rescue false)
    @searchbar = false
    render :welcome rescue nil and return
  end
rescue
  not_found
end