app/controllers/apicasso/crud_controller.rb in apicasso-0.2.4 vs app/controllers/apicasso/crud_controller.rb in apicasso-0.2.5
- old
+ new
@@ -17,15 +17,17 @@
# `updated_at`, filtered by the ones that have a `domain` that matches
# exactly `"domain.com"`, paginating records 42 per page and retrieving
# the page 42 of that collection. Usage:
# GET /sites?sort=+name,-updated_at&q[domain_eq]=domain.com&page=42&per_page=42
def index
+ set_access_control_headers
render json: index_json
end
# GET /:resource/1
def show
+ set_access_control_headers
render json: @object.to_json(include: parsed_include)
end
# PATCH/PUT /:resource/1
def update
@@ -70,15 +72,11 @@
# OPTIONS /:resource
# OPTIONS /:resource/1/:nested_resource
# Will return a JSON with the schema of the current resource, using
# attribute names as keys and attirbute types as values.
def schema
- if preflight?
- set_access_control_headers
- head :no_content
- else
- render json: resource_schema.to_json
- end
+ byebug
+ render json: resource_schema.to_json unless preflight?
end
private
# Common setup to stablish which model is the resource of this request