1
我有相同的錯誤Fix protocol Ecto.Queryable not implemented error但我認爲有不同的情況Ecto.Queryable不執行[...]
我想(以下鳳凰書)限制Estimate
s表示可以刪除給用戶擁有的,除非他們擁有管理員權限。
def delete(conn, %{"id" => id}, user) do
user_estimates =
case user.customer_id == 1 do
true ->
IO.inspect("Admin")
Repo.all(Estimate)
false ->
IO.inspect("Non-Admin")
assoc(user, :estimates)
end
estimate = Repo.get!(user_estimates, id)
Repo.delete!(estimate)
但是,當我使用這個函數作爲管理員,我得到
**(Protocol.UndefinedError)協議Ecto.Queryable不是[所有預算清單]
實施我誤解了什麼?