@@ -41,22 +41,24 @@ def filter_not_eq(scope, attribute, value)
4141 alias_method :filter_enum_not_eql , :filter_not_eq
4242
4343 def filter_string_eq ( scope , attribute , value , is_not : false )
44+ return filter_string_eql ( scope , attribute , nil , is_not : is_not ) if Array ( value ) . compact . blank?
45+
4446 column = column_for ( scope , attribute )
45- clause = column . lower . eq_any ( value . map ( & : downcase) )
47+ clause = column . lower . eq_any ( value . map { | val | val . downcase } )
4648 is_not ? scope . where . not ( clause ) : scope . where ( clause )
4749 end
4850
4951 def filter_string_eql ( scope , attribute , value , is_not : false )
50- clause = { attribute => value }
52+ clause = { attribute => value . presence }
5153 is_not ? scope . where . not ( clause ) : scope . where ( clause )
5254 end
5355
5456 def filter_string_not_eq ( scope , attribute , value )
55- filter_string_eq ( scope , attribute , value , is_not : true )
57+ filter_string_eq ( scope , attribute , value . presence , is_not : true )
5658 end
5759
5860 def filter_string_not_eql ( scope , attribute , value )
59- filter_string_eql ( scope , attribute , value , is_not : true )
61+ filter_string_eql ( scope , attribute , value . presence , is_not : true )
6062 end
6163
6264 # Arel has different match escaping behavior before rails 5.
0 commit comments