...

/

Basic Pry Consoling

Basic Pry Consoling

Get an overview of some debugging examples and run them in the Pry console.

Debugging examples

We’ve set Pry up as our Rails console, so we can access it with a simple rails console:

Terminal 1
Terminal
Loading...

Try running the following commands in the rails console:

Press + to interact
> 1 + 1
> project = Project.new(name: "Project Runway")

Examine object

Pry allows us to closely examine the current object under the scope, which we can determine with the self command. Right now, the current object is main:

Press + to interact
> self
> ls

Unix directory

Pry uses the Unix directory navigation metaphor to work through object trees. So, just as typing ls in a regular Unix terminal gives us a list ...