You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation doesn't agree with what ransack does. Despite the existence of predicates, "_cont" for LIKE and "_i_cont" for ILIKE, for PostgreSQL it treats both as one thing, including the result expected by the test predicate_spec.rb.
I believe it shouldn't be like that, since there may be performance differences between LIKE and ILIKE, in addition to diverging from the documentation.
Looking at the documentation at using-predicate which reports the following result for the "_cont" predicate
>> User.ransack(first_name_cont: 'Rya').result.to_sql
=> SELECT "users".* FROM "users" WHERE ("users".."first_name" LIKE '%Rya%')
And the matching page at search-matches which reports the following match for the predicate "_cont"
Predicate: *_cont
Description: Contains value
Notes: use LIKE
When I run the query in my environment with PostgreSQL, the result is different:
irb> Common::Person.ransack(name_cont: 'Assem').result.to_sql
=> "SELECT \"common_people\".* FROM \"common_people\" WHERE \"common_people\".\"name\" ILIKE '%Assem%'"
The text was updated successfully, but these errors were encountered:
Just noticed this myself so thank you for making the issue so I know I'm not imaging things 😆
FWIW I almost always want case insensitive searching but w/ this bug there doesn't appear to be an option for case sensitive search using Ransack should I need it.
Ransack version: 4.0.0
The documentation doesn't agree with what ransack does. Despite the existence of predicates, "_cont" for LIKE and "_i_cont" for ILIKE, for PostgreSQL it treats both as one thing, including the result expected by the test
predicate_spec.rb.
I believe it shouldn't be like that, since there may be performance differences between LIKE and ILIKE, in addition to diverging from the documentation.
Looking at the documentation at using-predicate which reports the following result for the "_cont" predicate
And the matching page at search-matches which reports the following match for the predicate "_cont"
When I run the query in my environment with PostgreSQL, the result is different:
The text was updated successfully, but these errors were encountered: