Sha256: 91df2cae25207b665513e96d52bd257a2e0ad15acff1598a36d3521311f9e1aa

Contents?: true

Size: 595 Bytes

Versions: 21

Compression:

Stored size: 595 Bytes

Contents

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

21 entries across 21 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.30.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.29.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.28.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.28.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.27.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.27.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.26.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.25.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.25.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.24.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.23.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.23.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.22.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.21.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.20.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.20.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.19.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.18.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.18.0 app/controllers/concerns/shipit/api/rendering.rb