Sha256: 7d9ca692093c3c1bceb2c21669f9f6d91f81618dd17b61c87c6e18d303aa0570
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
module Rapporteur # A customization of the default Rails ActionController::Responder. # Primarily, this is used to smooth out the differences between Rails # responder versions and allow for error messages in GET requests. # class Responder < ActionController::Responder # Internal: Overrides the default behavior by ignoring the HTTP verb and # always responding with errors if the rendering resource contains errors. # def to_format if has_errors? display_errors else super end end protected if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 1 def display_errors controller.render format => {errors: resource.errors}, status: :internal_server_error end else def display_errors controller.render format => resource_errors, status: :internal_server_error end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rapporteur-2.1.0 | lib/rapporteur/responder.rb |