Cleanup Lint/AssignmentInCondition rubocop issues on code and remove it from ruboco_todo list

This commit is contained in:
Bertocq
2017-06-16 00:17:19 +02:00
parent 87e73e772c
commit 21c6d1c4dd
7 changed files with 28 additions and 24 deletions

View File

@@ -37,8 +37,10 @@ class Legislation::AnnotationsController < ApplicationController
range_start: annotation_params[:ranges].first[:start], range_start_offset: annotation_params[:ranges].first[:startOffset].to_i,
range_end: annotation_params[:ranges].first[:end], range_end_offset: annotation_params[:ranges].first[:endOffset].to_i).first
if @annotation = existing_annotation
if comment = @annotation.comments.create(body: annotation_params[:text], user: current_user)
@annotation = existing_annotation
if @annotation.present?
comment = @annotation.comments.create(body: annotation_params[:text], user: current_user)
if comment.present?
render json: @annotation.to_json
else
render json: comment.errors.full_messages, status: :unprocessable_entity