Class: JsonSchemaRails::SchemasController

Inherits:
ApplicationController show all
Defined in:
app/controllers/json_schema_rails/schemas_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

Raises:

  • (ActionController::RoutingError)


3
4
5
6
7
8
9
10
11
# File 'app/controllers/json_schema_rails/schemas_controller.rb', line 3

def show
  schema = JsonSchemaRails.lookup_schema(params[:id])
  raise ActionController::RoutingError.new('No Such Schema') unless schema

  respond_to do |format|
    format.yaml { render text: schema.to_hash.to_yaml, content_type: 'text/yaml' }
    format.json { render json: schema }
  end
end