Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. vars = []
  2. query = ""
  3.  
  4. words.each do |word|
  5. query << " or " if query.any?
  6. query << "name like ? or lastname like ?"
  7. 2.times {vars << "%#{word}%"}
  8. end
  9.  
  10. conditions = []
  11. conditions << query
  12. vars.map {|v| conditions << v}
  13.  
  14.  
  15. por :
  16.  
  17. conditions = [""]
  18. words.each do |word|
  19. conditions.first << " or " if query.any?
  20. conditions.first << "name like ? or lastname like ?"
  21. conditions << "%#{word}%"
  22. conditions << "%#{word}%"
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement