Method: Discussion::CommentsController#create

Defined in:
app/controllers/discussion/comments_controller.rb

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/discussion/comments_controller.rb', line 24

def create
  build_resource
  respond_to do |format|
    if @comment.save
      format.html { redirect_to :back }
      format.js { collection }
      format.json { render json: @comment, status: :created, location: @comment }
    else
      format.html { render action: "new" }
      format.json { render json: @comment.errors, status: :unprocessable_entity }
    end
  end
end