Se agregan anotaciones a propuestas existentes
This commit is contained in:
19
app/controllers/annotations_controller.rb
Normal file
19
app/controllers/annotations_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class AnnotationsController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token
|
||||
load_and_authorize_resource
|
||||
|
||||
def create
|
||||
@annotation = Annotation.new(annotation_params)
|
||||
if @annotation.save
|
||||
render json: @annotation.to_json
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def annotation_params
|
||||
params
|
||||
.require(:annotation)
|
||||
.permit(:quote, :text, ranges: [:start, :startOffset, :end, :endOffset])
|
||||
.merge(proposal_id: params[:proposal_id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user