Module: Wallaby::ApplicationConcern

Extended by:
ActiveSupport::Concern
Includes:
Engineable, Urlable
Defined in:
lib/concerns/wallaby/application_concern.rb

Overview

Here, it provides the most basic functions e.g. error handling for common 4xx HTTP status, helpers method, and URL handling.

Instance Method Summary collapse

Methods included from Urlable

#edit_path, #index_path, #new_path, #show_path, #url_for

Methods included from Engineable

#current_engine, #current_engine_name, #current_engine_route, #script_name

Instance Method Details

#bad_request(exception = nil) ⇒ Object

Bad request page

Parameters:

  • exception (Exception) (defaults to: nil)

    comes from rescue_from



35
36
37
# File 'lib/concerns/wallaby/application_concern.rb', line 35

def bad_request(exception = nil)
  render_error exception, __callee__
end

#healthyObject

Health check page



23
24
25
# File 'lib/concerns/wallaby/application_concern.rb', line 23

def healthy
  render plain: 'healthy'
end

#helpersObject

helpers exists since Rails 5.0, need to mimic this to support Rails 4.2.



62
63
64
# File 'lib/concerns/wallaby/application_concern.rb', line 62

def helpers
  @helpers ||= defined?(super) ? super : try(:view_context)
end

#internal_server_error(exception = nil) ⇒ Object

Internal server error page

Parameters:

  • exception (Exception) (defaults to: nil)

    comes from rescue_from



47
48
49
# File 'lib/concerns/wallaby/application_concern.rb', line 47

def internal_server_error(exception = nil)
  render_error exception, __callee__
end

#not_found(exception = nil) ⇒ Object

Not found page

Parameters:

  • exception (Exception) (defaults to: nil)

    comes from rescue_from



29
30
31
# File 'lib/concerns/wallaby/application_concern.rb', line 29

def not_found(exception = nil)
  render_error exception, __callee__
end

#not_implemented(exception = nil) ⇒ Object

Not implemented

Parameters:

  • exception (Exception) (defaults to: nil)

    comes from rescue_from



53
54
55
# File 'lib/concerns/wallaby/application_concern.rb', line 53

def not_implemented(exception = nil)
  render_error exception, __callee__
end

#unprocessable_entity(exception = nil) ⇒ Object

Unprocessable entity page

Parameters:

  • exception (Exception) (defaults to: nil)

    comes from rescue_from



41
42
43
# File 'lib/concerns/wallaby/application_concern.rb', line 41

def unprocessable_entity(exception = nil)
  render_error exception, __callee__
end