I'm making a new Phoenix app for the first time in about a year, and trying to get a handle on everything that's changed with regards to context etc.
My first order of business is creating a database table where I can track email signups, so I put this command in:
mix phx.gen.html Signups Email emails email:string name:string data:text
And then I put the new routes in my router.ex. But even before I can migrate, I get an error:
== Compilation error in file lib/appname/views/email_view.ex ==
** (CompileError) lib/appname/views/email_view.ex:2: module AppnameWeb is not loaded and could not be found
(elixir) expanding macro: Kernel.use/2
lib/appname/views/email_view.ex:2: AppnameWeb.EmailView (module)
(elixir) lib/kernel/parallel_compiler.ex:121: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
I have Appname.Web other places in my app, but the generator created a new module called AppnameWeb that doesn't seem to be loaded anywhere?
If I do a find and replace in my project to Appname.Web to AppnameWeb, it lets me migrate but still fails to load the new emails index page.
Request: GET /emails
** (exit) an exception was raised:
** (UndefinedFunctionError) function Appname.EmailController.init/1 is undefined (module Appname.EmailController is not available)
(appname) web/router.ex:1: anonymous fn/1 in Appname.Router.__match_route__/4
(phoenix) lib/phoenix/router.ex:278: Phoenix.Router.__call__/1
(appname) lib/appname/endpoint.ex:1: Appname.Endpoint.plug_builder_call/2
(appname) lib/plug/debugger.ex:99: Appname.Endpoint."call (overridable 3)"/2
(appname) lib/appname/endpoint.ex:1: Appname.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) /Users/user/Dev/appname/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
So am I supposed to have both Appname.Web and AppnameWeb? I'm not sure what's supposed to go where any more, and the fact that the generator generates broken code isn't helping...
I tried making a new app again and run into the exact same error.