Class: Course::Assessment::Submission::Answer::Programming::AnnotationsController

Inherits:
Controller
  • Object
show all
Includes:
Discussion::PostsConcern
Defined in:
app/controllers/course/assessment/submission/answer/programming/annotations_controller.rb

Instance Method Summary collapse

Methods included from Discussion::PostsConcern

#skip_update_topic_status, #update_topic_pending_status

Instance Method Details

#createObject


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/course/assessment/submission/answer/programming/annotations_controller.rb', line 16

def create
  result = @annotation.class.transaction do
    @post.title = @assessment.title

    raise ActiveRecord::Rollback unless @post.save && create_topic_subscription && update_topic_pending_status
    raise ActiveRecord::Rollback unless @annotation.save
    true
  end

  if result
    send_created_notification(@post)
    render_create_response
  else
    head :bad_request
  end
end