Can't print out anything to console using IO puts in controller

Hi, newbie here, in the elixir world and I have problem: I can’t get anything to show inside of a console, when I want to print out something to a console when controller function is being called.

  def update_profile(conn, %{"user" => user_params}) do
    # user = Guardian.Plug.current_resource(conn)
    IO.puts("test")
    # with {:ok, %User{} = user} <- Accounts.update_user(user, user_params) do
    #   render(conn, "show.json", user: user)
    # end
  end

And yes, this function is 100% being called… No idea why I’m getting this strange behaviour. Any help would be appreciated! Thanks!

This should totally work. How do you start your application?

1 Like

I figured it out. Problem wasn’t with the provided code, but with the pattern matching. Basically function was never called because params didn’t match when it was called. I’m all new to this pattern matching concept and didn’t really got it until now! :relaxed: Cheers! Case closed

4 Likes