Sha256: 10373629ba730f8c5d8db8b00a69d09fac23a055788452768104736aeef28038
Contents?: true
Size: 631 Bytes
Versions: 10
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true module Shipit module Api module Rendering private def render_resources(resources, options = {}) options[:json] = resources render(options) end def render_resource(resource, options = {}) if resource.destroyed? head(:no_content, options.reverse_merge(content_type: 'application/json')) elsif resource.errors.any? render(options.reverse_merge(status: :unprocessable_entity, json: { errors: resource.errors })) else render(options.reverse_merge(json: resource)) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems