Phoenix: mix phx.gen.html generates controller and view with quotes around web module name

Created on 25 Jul 2017  路  6Comments  路  Source: phoenixframework/phoenix

Environment

  • Elixir version 1.4.4:
  • Phoenix version 1.3-rc3:
  • NodeJS version v6.9.5:
  • NPM version 3.10.10:
  • Operating system: OSX

Expected behavior

When I execute mix phx.gen.html Accounts User users in the web app (umbrella setup), it generates the following controller and view:

defmodule MyAppWeb.UserController do
  use MyAppWeb, :controller

  alias MyApp.Accounts
  alias MyApp.Accounts.User
  ...
end
defmodule MyAppWeb.UserView do
  use MyAppWeb, :view
end

Actual behavior

It instead generates the following controller and view (look at the quotes around the MyAppWeb module name/namespace):

defmodule "MyAppWeb".UserController do
  use "MyAppWeb", :controller

  alias MyApp.Accounts
  alias MyApp.Accounts.User
  ...
end
defmodule "MyAppWeb".UserView do
  use "MyAppWeb", :view
end

The context module, ecto schema and migration looks fine tho.

bug

Most helpful comment

Confirmed bug only for umbrella applications. I will take care of this shortly. Thanks for reporting!

All 6 comments

Confirmed bug only for umbrella applications. I will take care of this shortly. Thanks for reporting!

Hello,i added the fix, but the problem still persist on my side (Phx 1.3 Rc3 --umbrella flag).
i have to remove quotes manually

Did you point your :phoenix dep at github: "phoenixframework/phoenix" ?

I didn't ... how to do that? here is the original one {:phoenix, "~> 1.3.0-rc"}
like that...{:phoenix, "https://github.com/phoenixframework/phoenix"}, ?

How did you add the fix? We haven't released a new version with this fix so the only way to pull it in is to set your dep at the git repo with:

{:phoenix, github: "phoenixframework/phoenix", override: true}

in mix.exs

thank you! didn't know I could do it like that.

Was this page helpful?
0 / 5 - 0 ratings