Closed 7stud closed 4 years ago
Hi @7stud. Thank you for question.
I can see it can be a bit confusing, but the missing functions are actually generated by Phoenix when running mix phx.gen.context UserManager User users username:string password:string
, what is command does; is create a new User in the UserManager context, and it is in this context the functions are auto generated. I hope this makes sense
Okay, thanks for the tips. I added the two required functions to my UserManager context. However, there are a few other errors in the tutorial that will keep any beginner from ever getting the Guardian example to work. I had to dig through the source code and follow a trail through two macros to figure out one error in the tutorial. I am going to submit a pull request to fix the tutorial.
I am sorry to hear that there are other problems with the tutorial, as stated above those two functions should be auto generated, when the tutorial ask you to run mix phx.gen.context UserManager User users username:string password:string. If there are any other problems just let us know and we will have a look at them
(1) The only function that the tutorial puts in
lib/auth_me/user_manager.ex
is:Yet, in
lib/auth_me_web/controllers/session_controller.ex
the tutorial calls the function:here:
Is
AuthMe.UserManager.change_user()
simply a wrapper aroundAuthMe.UserManager.User.changeset()
, for instance:(2)
In
lib/auth_me/user_manager.ex
:the
query
line will throw an error without:(3) The tutorial calls another undefined function in the Try it Out section: