Skip to content

Commit

Permalink
Check type before sending #value message to predicate
Browse files Browse the repository at this point in the history
The previous implementation was giving for granted that every predicate
respond  to `#value`, but that doesn't seem to be the case at least when
having a `Arel::SelectManager`.

by simply inverting the terms of the existing AND check we can fix the issue
without introducing unknown side effects.
  • Loading branch information
spaghetticode committed Dec 15, 2023
1 parent cc624b9 commit e72e954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ransack/nodes/condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def in_predicate?(predicate)
end

def casted_array?(predicate)
predicate.value.is_a?(Array) && predicate.is_a?(Arel::Nodes::Casted)
predicate.is_a?(Arel::Nodes::Casted) && predicate.value.is_a?(Array)
end

def format_values_for(predicate)
Expand Down

0 comments on commit e72e954

Please sign in to comment.