Reputation: 1046
Getting the issue on compilation, please have a look, may be anyone is familiar with the error
== 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
end
Upvotes: 3
Views: 4306
Reputation: 1046
Removed 'Model' in Ecto.Model, as use Ecto.Model has been deprecated and removed
Thank you @Dogbert, for help.
Upvotes: 3