Reputation: 81
this_id is a string, that is an array, the_other is a boolean (from before I learned to default: false).
I do not know the format a search where the arrays('that') are not empty, [], i.e., have at least one thing in it. Thanks!
This.where("this_id = ? and that = ? and the_other IS NOT NULL", "#{@this.id}", ...NOT_EMPTY?)
Upvotes: 1
Views: 1139
Reputation: 742
According to the PostgreSQL array documentation here, To compare with array type column you can use '{}'
, so you can write your query like this
This.where("this_id = ? and that != '{}' and the_other IS NOT NULL", "#{@this.id}")
This should return the required rows.
Upvotes: 2