fix not support &. operation in low ruby version

openi_sso
p31729568 6 years ago
parent 44dadbc173
commit f1b1ea0cd3

@ -14,7 +14,7 @@ class Management::SchoolReportService
def call def call
schools = School.select(select_columns_sql) schools = School.select(select_columns_sql)
keyword = params[:keyword]&.to_s&.strip keyword = params[:keyword].try(:to_s).try(:strip)
if keyword.present? if keyword.present?
schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%")
end end

Loading…
Cancel
Save