Class: AnnotatorStore::AnnotationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AnnotatorStore::AnnotationsController
- Defined in:
- app/controllers/annotator_store/annotations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /annotations.
-
#destroy ⇒ Object
DELETE /annotations/1.
-
#options ⇒ Object
OPTIONS /annotations.
-
#show ⇒ Object
GET /annotations/1.
-
#update ⇒ Object
PATCH/PUT /annotations/1.
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#options ⇒ Object
OPTIONS /annotations
45 46 47 48 49 |
# File 'app/controllers/annotator_store/annotations_controller.rb', line 45 def respond_to do |format| format.json { render :options } end end |
#show ⇒ Object
GET /annotations/1
21 22 |
# File 'app/controllers/annotator_store/annotations_controller.rb', line 21 def show end |
#update ⇒ Object
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 |