Skip to content

Commit 03aa1a0

Browse files
authored
Merge pull request #139 from brosquinha/fix/enum-ilike
Add type cast to string
2 parents 117a4f6 + 875d58c commit 03aa1a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/kaffy/resource_query.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ defmodule Kaffy.ResourceQuery do
118118
query = from(s in q, join: a in assoc(s, ^association))
119119

120120
Enum.reduce(fields, query, fn f, current_query ->
121-
from([..., r] in current_query, or_where: ilike(field(r, ^f), ^term))
121+
from([..., r] in current_query, or_where: ilike(type(field(r, ^f), :string), ^term))
122122
end)
123123

124124
f, q ->
125-
from(s in q, or_where: ilike(field(s, ^f), ^term))
125+
from(s in q, or_where: ilike(type(field(s, ^f), :string), ^term))
126126
end)
127127
end
128128

0 commit comments

Comments
 (0)