Sha256: 9be89cf5792cf84a385807e7cddbc5149b1ec97f6f8e0f3e734656d2712bfc5a
Contents?: true
Size: 982 Bytes
Versions: 3
Compression:
Stored size: 982 Bytes
Contents
module Transponder module Transmission extend ActiveSupport::Concern included do after_filter :intercept_js helper_method :xms_module_name end def xms_module_name params[:controller].include?('/') ? params[:controller].split('/')[0] : 'application' end def xms_error_hash(object, message, action, module_name) { errors: (message || object.errors ), controller: controller_name, action: (action || action_name), model_name: object.class.name.downcase, id: object.id, module: (module_name || xms_module_name) } end def xms_error object, message: nil, action: nil, module_name: nil render json: xms_error_hash(object, message, action, module_name), status: :unprocessable_entity end def intercept_js if request.format == :js response.header['Content-Type'] = "application/transmission" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
transponder-0.9.6 | lib/transponder/transmission.rb |
transponder-0.9.5 | lib/transponder/transmission.rb |
transponder-0.9.4 | lib/transponder/transmission.rb |