-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
post |> Post.parent() |> Repo.one()
results in
** (Ecto.Query.CastError) deps/ecto_materialized_path/lib/ecto_materialized_path.ex:73: value
4inwherecannot be cast to type {:in, :id} in query:from a in Post
where: a.id in ^4,
limit: 1,
select: a(elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir) lib/enum.ex:1397: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3 (ecto) lib/ecto/repo/queryable.ex:124: Ecto.Repo.Queryable.execute/5 (ecto) lib/ecto/repo/queryable.ex:37: Ecto.Repo.Queryable.all/4 (ecto) lib/ecto/repo/queryable.ex:70: Ecto.Repo.Queryable.one/4 (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6 (iex) lib/iex/evaluator.ex:250: IEx.Evaluator.handle_eval/5 (iex) lib/iex/evaluator.ex:230: IEx.Evaluator.do_eval/3 (iex) lib/iex/evaluator.ex:208: IEx.Evaluator.eval/3
Running post |> Post.parent() returns
#Ecto.Query<from a in Post, where: a.id in ^4, limit: 1>
The use of the in operator seems weird to me, but it has been there for over a year, and noone has complained yet. This makes me wonder if I am doing something wrong.
Metadata
Metadata
Assignees
Labels
No labels