]> git.openstreetmap.org Git - rails.git/commitdiff
Fix Rubocop issue
authorENT8R <info.ent8r@gmail.com>
Tue, 9 Oct 2018 12:50:55 +0000 (14:50 +0200)
committerENT8R <info.ent8r@gmail.com>
Tue, 9 Oct 2018 12:50:55 +0000 (14:50 +0200)
app/controllers/notes_controller.rb

index 27c3f4f83d08fcbc7ff51fe7c97ffd4e6264cfdf..18b862014136123557a3a678ce2bd28df4d1011b 100644 (file)
@@ -275,11 +275,11 @@ class NotesController < ApplicationController
     # Filter by a given string
     if params[:q]
       @notes = @notes.joins(:comments)
-      if @user
-        @notes = @notes.where("to_tsvector('english', comments_notes.body) @@ plainto_tsquery('english', ?)", params[:q])
-      else
-        @notes = @notes.where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", params[:q])
-      end
+      @notes = if @user
+                 @notes.where("to_tsvector('english', comments_notes.body) @@ plainto_tsquery('english', ?)", params[:q])
+               else
+                 @notes.where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", params[:q])
+               end
     end
 
     # Filter by a given start date and an optional end date