trenpixster / addict

User management lib for Phoenix Framework
MIT License
645 stars 99 forks source link

Hitting an error immediately after install #76

Closed danieljaouen closed 8 years ago

danieljaouen commented 8 years ago

Hi,

I'm new to addict and relatively new to Phoenix and Elixir as well, so I might have done something wrong on my end, but I'm seeing an error immediately upon visiting the "/login" and "/register" pages. Here's the error:

[error] #PID<0.336.0> running Email.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /login
** (exit) an exception was raised:
    ** (UndefinedFunctionError) undefined function Email.Addict.AddictController.init/1 (module Email.Addict.AddictController is not available)
        Email.Addict.AddictController.init(:login)
        (Email) web/router.ex:1: anonymous fn/1 in Email.Router.match_route/4
        (Email) lib/phoenix/router.ex:261: Email.Router.dispatch/2
        (Email) web/router.ex:1: Email.Router.do_call/2
        (Email) lib/email/endpoint.ex:1: Email.Endpoint.phoenix_pipeline/1
        (Email) lib/plug/debugger.ex:93: Email.Endpoint."call (overridable 3)"/2
        (Email) lib/phoenix/endpoint/render_errors.ex:34: Email.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
trenpixster commented 8 years ago

@danieljaouen it seems your router.ex file has incorrect module loading. Please make sure that your scope command is not assuming the module. So instead of:

scope "/", Email do
  (...)
  addict :routes
  (...)
end

make sure you have something like this instead:

scope "/" do
  (...)
  addict :routes
  (...)
end

Does this help?

danieljaouen commented 8 years ago

Yep, that did the trick. Thanks!