i have 2 controller :
page_controller.ex :
defmodule ColaWeb.PageController do
use ColaWeb, :controller
def index(conn, _params) do
render conn, "index.html"
end
end
my_controller.ex
defmodule ColaWeb.MyController do
use ColaWeb, :controller
def index(conn, _params) do
render conn, "index.html"
end
def laugh(conn, _params) do
conn |> json(%{"ok": 1}) # OK
end
end
Error :
function ColaWeb.MyView.render/2 is undefined (module ColaWeb.MyView is not available)
then i change my my_controller.ex :
defmodule ColaWeb.MyController do
use ColaWeb, :controller
use ColaWeb, :view
def index(conn, _params) do
render conn, "index.html"
end
def laugh(conn, _params) do
conn |> json(%{"ok": 1}) # OK
end
end
error :
lib/cola_web/controllers/my_controller.ex:1: imported Phoenix.Controller.render/2 conflicts with local function