Sanitize search, no little bobby tables

This commit is contained in:
ricky committed 2026-02-21 08:23:58 -05:00
1 parent 659a1fbcf0
commit 9b656534ae
1 file changed
+1
+1
View File
@@ -169,6 +169,7 @@ class Customer < ActiveRecord::Base
# Searchs the database for a customer by name or phone number with out special chars # Searchs the database for a customer by name or phone number with out special chars
def self.search(search) def self.search(search)
search = sanitize_sql_like(search)
customers = where("name LIKE ? OR phone_number LIKE ? OR mobile_phone_number LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%") customers = where("name LIKE ? OR phone_number LIKE ? OR mobile_phone_number LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%")
return customers.order(:name) return customers.order(:name)
end end