Je suis confronté à un tel problème dans lequel est présent dans les données. lors de la recherche, il ne montre pas les données. Je veux supprimer le code problème d'injection SQL ::MySql Query :: Comment résoudre le problème de 's dans les données, quand la requête est lancée
@search_condition = ""
if !search_text.nil?
search_field = search_text.split("-")
@search_condition = "(address_books.organization_name like '#{search_text}%' or address_books.business_name like '#{search_text}%' or address_books.federal_tax_id like '#{search_text}%' or address_books.city like '#{search_text}%' or address_books.zip like '#{search_text}%') " if search_field.length == 1
if search_text.include? "-"
if search_field.length <= 1
@search_condition = " (address_books.organization_name like '%" + search_field[0] + "%' "
@search_condition += " or address_books.business_name like '%" + search_field[1] + "%' "
@search_condition += " or address_books.federal_tax_id like '%" + search_field[2] + "%' "
@search_condition += " or address_books.city like '%" + search_field[3] + "%' "
@search_condition += " or address_books.zip like '%" + search_field[4] + "%') "