Ensure that 404 errors are thrown for inexistent annotations

This commit is contained in:
kikito
2015-12-16 18:07:03 +01:00
parent 22ec287b16
commit 6335732ce6

View File

@@ -11,14 +11,14 @@ class AnnotationsController < ApplicationController
end end
def update def update
@annotation = Annotation.find(params[:id]) @annotation = Annotation.find!(params[:id])
if @annotation.update_attributes(annotation_params) if @annotation.update_attributes(annotation_params)
render json: @annotation.to_json render json: @annotation.to_json
end end
end end
def destroy def destroy
@annotation = Annotation.find(params[:id]) @annotation = Annotation.find!(params[:id])
@annotation.destroy @annotation.destroy
render json: { status: :ok } render json: { status: :ok }
end end