Module: RestfulError::ActionController
- Defined in:
- lib/restful_error.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
42 43 44 45 46 |
# File 'lib/restful_error.rb', line 42 def self.included(base) base.rescue_from StandardError do |ex| render_exception ex end end |
Instance Method Details
#render_exception(ex) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/restful_error.rb', line 29 def render_exception(ex) @exception = ex.extend(Helper) ex.restful.set_env(request.env) @status_code = ex.restful.status_code @reason_phrase = ex.restful.reason_phrase = ex.restful. raise if @status_code == 500 && Rails.configuration.consider_all_requests_local respond_to do |format| format.any(:json, :xml, :html){ render 'restful_error/show', status: @status_code } end end |