madeintandem / hstore_accessor

Adds typed hstore-backed field support to ActiveRecord models.
MIT License
242 stars 47 forks source link

Bug: Querying Arrays #36

Closed andyl closed 9 years ago

andyl commented 9 years ago

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))

thegrubbsian commented 9 years ago

So @crismali is this fixed then?

thegrubbsian commented 9 years ago

Should be fixed with #39, please reopen if it's still an issue.

crismali commented 9 years ago

@thegrubbsian #39 fixed it