Sha256: 90e452f2fa1bcc37efe4d0568accc84af890f8b8b753bab51739a6988fc8a82f

Contents?: true

Size: 588 Bytes

Versions: 25

Compression:

Stored size: 588 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?
          options[:status] = :no_content
          options[:text] = nil
        elsif resource.errors.any?
          options[:json] = {errors: resource.errors}
          options[:status] = :unprocessable_entity
        else
          options[:json] = resource
        end
        render options
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
shipit-engine-0.16.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.15.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.14.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.13.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.12.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.12.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.11.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.10.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.9.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.9 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.8 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.7 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.6 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.5 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.4 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.3 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.2 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.1 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.8.0 app/controllers/concerns/shipit/api/rendering.rb
shipit-engine-0.7.0 app/controllers/concerns/shipit/api/rendering.rb