Skip to content

Commit

Permalink
Merge pull request #325 from anhnk/bug/search-field-association
Browse files Browse the repository at this point in the history
Fix bug related to search field across association
  • Loading branch information
ghenry authored Dec 15, 2024
2 parents c89f9cd + 9096c41 commit 87e2d5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/kaffy/resource_query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ defmodule Kaffy.ResourceQuery do
term_type == :string do
term = "%#{term}%"

from(r in current_query,
from([..., r] in current_query,
or_where: ilike(type(field(r, ^f), :string), ^term)
)
else
if Kaffy.ResourceSchema.field_type(schema, f) in [:id, :integer] and
term_type == :decimal do
current_query
else
from(r in current_query,
from([..., r] in current_query,
or_where: field(r, ^f) == ^term
)
end
Expand Down

0 comments on commit 87e2d5e

Please sign in to comment.