Fixed use of delete!()

This commit is contained in:
Martin Edenhofer 2015-08-22 01:55:59 +02:00
parent 11c84c0fe0
commit 492a38ad35
3 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ returns
# fallback do sql query # fallback do sql query
# - stip out * we already search for *query* - # - stip out * we already search for *query* -
query.delete! '*', '' query.delete! '*'
organizations = Organization.where( organizations = Organization.where(
'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%" 'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
).order('name').limit(limit) ).order('name').limit(limit)

View file

@ -146,7 +146,7 @@ returns
# do query # do query
# - stip out * we already search for *query* - # - stip out * we already search for *query* -
if query if query
query.delete! '*', '' query.delete! '*'
tickets_all = Ticket.select('DISTINCT(tickets.id)') tickets_all = Ticket.select('DISTINCT(tickets.id)')
.where(access_condition) .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}%" ) .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}%" )

View file

@ -68,7 +68,7 @@ returns
# fallback do sql query # fallback do sql query
# - stip out * we already search for *query* - # - stip out * we already search for *query* -
query.delete! '*', '' query.delete! '*'
if params[:role_ids] if params[:role_ids]
users = User.joins(:roles).where( 'roles.id' => params[:role_ids] ).where( 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}%", '(users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%",