Pry in Elixir Phoenix
One of my favorite debugging tools in Ruby is Pry, so I wanted to find something similar to use when developing Phoenix applications. Thankfully Elixir has pry built in!
To use it in Phoenix, simply include this line wherever you want to pry:
require IEx; IEx.pry
I then had to start my server in an IEx session to get the pry to work (I've read this will be fixed soon):
iex -S mix phoenix.server
When you hit that function, you will be asked to confirm that you want to Pry
Request to pry #PID<0.331.0> at web/controllers/user_controller.ex:7. Allow? [Yn]
Confirm by typing Y
and you will be good to pry away!
pry(1)>
Tweet