Class: PingController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ping_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#is_data_controller, #is_task_controller, #meta_data, #meta_description, #meta_keywords, #meta_title, #page_title, #site_name

Instance Method Summary (collapse)

Methods inherited from ApplicationController

#digest_cookie, #digested_cookie_exists?, #disable_turbolinks, #invalid_object, #is_data_controller?, #is_task_controller?, #log_user_recent_route, #project_matches, #record_not_found, #set_project_from_params

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#project_link, #project_tag, #projects_list, #projects_search_form

Methods included from InterceptApi

#intercept_api, #token_authenticate

Instance Method Details

- (Boolean) asset_exists?(path) (protected)

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
# File 'app/controllers/ping_controller.rb', line 17

def asset_exists?(path)
  begin
    pathname = Rails.application.assets.resolve(path)
    return !!pathname # double-bang turns String into boolean
  rescue Sprockets::FileNotFound
    return false
  end
end

- (Object) ping



3
4
5
# File 'app/controllers/ping_controller.rb', line 3

def ping
  render json: '{"pong": true}', status: :ok
end

- (Object) pingz



7
8
9
10
11
12
13
# File 'app/controllers/ping_controller.rb', line 7

def pingz
  if asset_exists?('zzzz.css')
    render json: '{"pong": true}', status: :ok 
  else
    head :service_unavailable 
  end
end