Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vars = []
- query = ""
- words.each do |word|
- query << " or " if query.any?
- query << "name like ? or lastname like ?"
- 2.times {vars << "%#{word}%"}
- end
- conditions = []
- conditions << query
- vars.map {|v| conditions << v}
- por :
- conditions = [""]
- words.each do |word|
- conditions.first << " or " if query.any?
- conditions.first << "name like ? or lastname like ?"
- conditions << "%#{word}%"
- conditions << "%#{word}%"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement