a7em-g
Last Updated: February 25, 2016
·
1.746K
· daemonsy

Nifty last result in IRB ( result = _ )

1.9.3p194 :048 > Product.find(32) # Shit I forgot to assign it a var for manipulation
1.9.3p194 :049 > product = _     # No fear, use _ for the last result. 

In Rails Console/IRB, using var = _ will assign the last result to the statement.

Super nifty because I tend to forget the assignment, mind's on constructing the statement.

I first saw this in one of Ryan Bates' railscast episode. Felt like a better man ever since =)