Hi,
I’ve encountered an issue with the eql filter for strings while using PostgreSQL as the database for my Rails application. The current implementation of the filter_string_eql method does not enforce case-sensitive filtering, which is problematic when exact, case-sensitive matches are required.
Here’s the current implementation of filter_string_eql:
def filter_string_eql(scope, attribute, value, is_not: false)
clause = { attribute => value }
is_not ? scope.where.not(clause) : scope.where(clause)
end
Steps to Reproduce:
Given a user record with an email attribute set to test@example.com, a call such as:
filter_string_eql(User.all, :email, ["TEST@example.com"])
unexpectedly includes that record in the resulting scope.
Expected Behavior:
The filter_string_eql method should enforce case-sensitive filtering. In the above example, the method should exclude the record because TEST@example.com is not an exact, case-sensitive match for `test@example.com.
Thank you for investigating this!
Hi,
I’ve encountered an issue with the
eqlfilter for strings while using PostgreSQL as the database for my Rails application. The current implementation of thefilter_string_eqlmethod does not enforce case-sensitive filtering, which is problematic when exact, case-sensitive matches are required.Here’s the current implementation of
filter_string_eql:Steps to Reproduce:
Given a user record with an email attribute set to
test@example.com, a call such as:unexpectedly includes that record in the resulting scope.
Expected Behavior:
The
filter_string_eqlmethod should enforce case-sensitive filtering. In the above example, the method should exclude the record becauseTEST@example.comis not an exact, case-sensitive match for `test@example.com.Thank you for investigating this!