Closed andyl closed 9 years ago
When you run Klas.xx_contains([array]), and array contains more than two strings, the operation fails.
Klas.xx_contains([array])
To fix, apply this change to macro.rb:80
macro.rb:80
old line: where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten
where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten
new line: where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten.join(Serialization::SEPARATOR))
where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten.join(Serialization::SEPARATOR))
So @crismali is this fixed then?
Should be fixed with #39, please reopen if it's still an issue.
@thegrubbsian #39 fixed it
When you run
Klas.xx_contains([array])
, and array contains more than two strings, the operation fails.To fix, apply this change to
macro.rb:80
old line:
where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten
new line:
where("string_to_array(#{query_field}, '#{Serialization::SEPARATOR}') @> string_to_array(?, '#{Serialization::SEPARATOR}')", Array[value].flatten.join(Serialization::SEPARATOR))