app/controllers/apicasso/crud_controller.rb in apicasso-0.2.0 vs app/controllers/apicasso/crud_controller.rb in apicasso-0.2.1
- old
+ new
@@ -70,11 +70,15 @@
# 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
- set_access_control_headers
- render json: resource_schema.to_json
+ if preflight?
+ set_access_control_headers
+ head :no_content
+ else
+ render json: resource_schema.to_json
+ end
end
private
# Common setup to stablish which model is the resource of this request