Class: Deposit::EngineController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Deposit::EngineController
- Defined in:
- app/controllers/deposit/engine_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#as_string(e) ⇒ Object
Used to format flash error messages.
- #current_tenant_user ⇒ Object
- #get_layout ⇒ Object
- #log_rescue_error(error) ⇒ Object
Instance Method Details
#as_string(e) ⇒ Object
Used to format flash error messages
8 9 10 11 12 13 14 15 |
# File 'app/controllers/deposit/engine_controller.rb', line 8 def as_string(e) if e.is_a?(KillBillClient::API::ResponseError) "Error #{e.response.code}: #{as_string_from_response(e.response.body)}" else log_rescue_error(e) e. end end |
#current_tenant_user ⇒ Object
25 26 27 28 29 30 |
# File 'app/controllers/deposit/engine_controller.rb', line 25 def current_tenant_user # If the rails application on which that engine is mounted defines such method (Devise), we extract the current user, # if not we default to nil, and serve our static mock configuration user = current_user if respond_to?(:current_user) Deposit.current_tenant_user.call(session, user) end |
#get_layout ⇒ Object
21 22 23 |
# File 'app/controllers/deposit/engine_controller.rb', line 21 def get_layout layout ||= Deposit.config[:layout] end |
#log_rescue_error(error) ⇒ Object
17 18 19 |
# File 'app/controllers/deposit/engine_controller.rb', line 17 def log_rescue_error(error) Rails.logger.warn "#{error.class} #{error.to_s}. #{error.backtrace.join("\n")}" end |