Class: AnnotatorStore::AnnotationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/annotator_store/annotations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /annotations



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/annotator_store/annotations_controller.rb', line 8

def create
  format_client_input_to_rails_convention_for_create
  @annotation = Annotation.new(annotation_params)
  respond_to do |format|
    if @annotation.save
      format.json { render :show, status: :created, location: annotation_url(@annotation) }
    else
      format.json { render json: @annotation.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /annotations/1



37
38
39
40
41
42
# File 'app/controllers/annotator_store/annotations_controller.rb', line 37

def destroy
  @annotation.destroy
  respond_to do |format|
    format.json { head :no_content, status: :no_content }
  end
end

#optionsObject

OPTIONS /annotations



45
46
47
48
49
# File 'app/controllers/annotator_store/annotations_controller.rb', line 45

def options
  respond_to do |format|
    format.json { render :options }
  end
end

#showObject

GET /annotations/1



21
22
# File 'app/controllers/annotator_store/annotations_controller.rb', line 21

def show
end

#updateObject

PATCH/PUT /annotations/1



25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/annotator_store/annotations_controller.rb', line 25

def update
  format_client_input_to_rails_convention_for_update
  respond_to do |format|
    if @annotation.update(annotation_params)
      format.json { render :show, status: :ok, location: annotation_url(@annotation) }
    else
      format.json { render json: @annotation.errors, status: :unprocessable_entity }
    end
  end
end