-
-
Notifications
You must be signed in to change notification settings - Fork 829
Description
The changes made in #1559 changed how values are casted for some/all boolean predicates like not_null.
Before the changes from the PR, when passing a non-boolean value to a boolean predicate (for example: name_not_null = 0), the Ransack::Nodes::Condition#casted_values_for_attribute method would call Ransack::Nodes::Value#cast using the predicate or attribute type. When the predicate type is boolean, the value would be cast to a proper boolean.
The changes in the PR just pass the value directly without any casting, so when calling the arel_predicate proc for the predicate, it will evaluate to true because 0 is truthy. Using a boolean value (like name_not_null = false) works as expected.
I'm not sure if this is a bug and these values should be properly cast, or if we're expected with Ransack 4.4.0 to use boolean values for these types of predicates.
Original issue #1555