DEV Community

Discussion on: How to use rails console like a boss?

Collapse
 
romainverbeke profile image
Romain Verbeke • Edited

I always use the command '_', it returns the latest object from the console.
For instance sometime I might tweak an ActiveRecord query until i gets the result i am looking for then iwould just store it in a variable by doing test = _


Users.joins(:posts).where(post_id: XXX)
users = _