Sha256: 1aca1b6fd56000d60cf0e4c4bd4f5fc4284ccf6af8491ad62c99a17b1e2da6a4

Contents?: true

Size: 528 Bytes

Versions: 22

Compression:

Stored size: 528 Bytes

Contents

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
shipit-engine-0.5.2 app/controllers/concerns/api/rendering.rb
shipit-engine-0.5.1 app/controllers/concerns/api/rendering.rb
shipit-engine-0.5.0 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.10 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.9 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.8 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.7 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.6 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.5 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.4 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.3 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.2 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.1 app/controllers/concerns/api/rendering.rb
shipit-engine-0.4.0 app/controllers/concerns/api/rendering.rb
shipit-engine-0.3.1 app/controllers/concerns/api/rendering.rb
shipit-engine-0.3.0 app/controllers/concerns/api/rendering.rb
shipit-engine-0.2.3 app/controllers/concerns/api/rendering.rb
shipit-engine-0.2.2 app/controllers/concerns/api/rendering.rb
shipit-engine-0.2.1 app/controllers/concerns/api/rendering.rb
shipit-engine-0.2.0 app/controllers/concerns/api/rendering.rb