获取编译问题,请看一下,可能是任何人都熟悉错误
== Compilation error on file web/controllers/order_controller.ex ==
** (CompileError) web/controllers/order_controller.ex:2: module Ecto.Model is not loaded and could not be found
expanding macro: PhoenixCart.Web.__using__/1
web/controllers/order_controller.ex:2: PhoenixCart.OrderController (module)
(elixir) expanding macro: Kernel.use/2
web/controllers/order_controller.ex:2: PhoenixCart.OrderController (module)
defmodule PhoenixCart.OrderController do
use PhoenixCart.Web, :controller
alias PhoenixCart.Order
plug :scrub_params, "order" when action in [:create, :update]
def index(conn, _params) do
orders = Repo.all(Order)
render(conn, "index.html", orders: orders)
end
##<more code>
end
def controller do
quote do
use Phoenix.Controller
# Alias the data repository and import query/model functions
alias PhoenixCart.Repo
import Ecto.Model
import Ecto.Query, only: [from: 2]
# Import URL helpers from the router
import PhoenixCart.Router.Helpers
end
端
答案 0 :(得分:3)
删除了Ecto.Model中的'Model',因为已弃用并删除了使用Ecto.Model
感谢@Dogbert,寻求帮助。