From 492a38ad3505f039ac421ab954db4c6a34d3d2c2 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 22 Aug 2015 01:55:59 +0200 Subject: [PATCH] Fixed use of delete!() --- app/models/organization/search.rb | 2 +- app/models/ticket/search.rb | 2 +- app/models/user/search.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/organization/search.rb b/app/models/organization/search.rb index ec008f731..62d6e4be4 100644 --- a/app/models/organization/search.rb +++ b/app/models/organization/search.rb @@ -68,7 +68,7 @@ returns # fallback do sql query # - stip out * we already search for *query* - - query.delete! '*', '' + query.delete! '*' organizations = Organization.where( 'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%" ).order('name').limit(limit) diff --git a/app/models/ticket/search.rb b/app/models/ticket/search.rb index 955743154..e045b3c79 100644 --- a/app/models/ticket/search.rb +++ b/app/models/ticket/search.rb @@ -146,7 +146,7 @@ returns # do query # - stip out * we already search for *query* - if query - query.delete! '*', '' + query.delete! '*' tickets_all = Ticket.select('DISTINCT(tickets.id)') .where(access_condition) .where( '( `tickets`.`title` LIKE ? OR `tickets`.`number` LIKE ? OR `ticket_articles`.`body` LIKE ? OR `ticket_articles`.`from` LIKE ? OR `ticket_articles`.`to` LIKE ? OR `ticket_articles`.`subject` LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" ) diff --git a/app/models/user/search.rb b/app/models/user/search.rb index 59f2a6bc6..6316d4bde 100644 --- a/app/models/user/search.rb +++ b/app/models/user/search.rb @@ -68,7 +68,7 @@ returns # fallback do sql query # - stip out * we already search for *query* - - query.delete! '*', '' + query.delete! '*' if params[:role_ids] users = User.joins(:roles).where( 'roles.id' => params[:role_ids] ).where( '(users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%",