Change your current context
You can change the context of your console session by using the cd
just like you would change the context of your directory.
Here is an example.
# Grab an object, in our example a customer.
c = Customer.all.sample
# Now, 'cd' in to that object.
cd c
# From here you will notice that we are now within
# the context of our object and can call methods on it directly.
pry(<Customer>):1> first_name
=> "Peter"
pry(<Customer>):1> last_name
=> "Parker"
I found this cool tip, as well as some others in this awesome blog post.
Tweet