module Wallaby::ApplicationConcern

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

Public Instance Methods

bad_request(exception = nil) click to toggle source

(see bad_request)

# File lib/concerns/wallaby/application_concern.rb, line 73
def bad_request(exception = nil)
  render_error exception, __callee__
end
healthy() click to toggle source

(see healthy)

# File lib/concerns/wallaby/application_concern.rb, line 63
def healthy
  render plain: 'healthy'
end
helpers() click to toggle source

(see helpers)

Calls superclass method
# File lib/concerns/wallaby/application_concern.rb, line 93
def helpers
  @helpers ||= defined?(super) ? super : view_context
end
internal_server_error(exception = nil) click to toggle source

(see internal_server_error)

# File lib/concerns/wallaby/application_concern.rb, line 83
def internal_server_error(exception = nil)
  render_error exception, __callee__
end
not_found(exception = nil) click to toggle source

(see not_found)

# File lib/concerns/wallaby/application_concern.rb, line 68
def not_found(exception = nil)
  render_error exception, __callee__
end
not_implemented(exception = nil) click to toggle source

(see not_implemented)

# File lib/concerns/wallaby/application_concern.rb, line 88
def not_implemented(exception = nil)
  render_error exception, __callee__
end
render_error(exception, symbol) click to toggle source

(see render_error)

# File lib/concerns/wallaby/application_concern.rb, line 100
def render_error(exception, symbol)
  Logger.error exception

  @exception = exception
  @symbol = symbol
  @code = Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol].to_i
  respond_with @exception, status: @code, template: ERROR_PATH, prefixes: _prefixes
end
unprocessable_entity(exception = nil) click to toggle source

(see unprocessable_entity)

# File lib/concerns/wallaby/application_concern.rb, line 78
def unprocessable_entity(exception = nil)
  render_error exception, __callee__
end