Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created May 21, 2013 15:59
Show Gist options
  • Save davetapley/5620948 to your computer and use it in GitHub Desktop.
Save davetapley/5620948 to your computer and use it in GitHub Desktop.
Execute ActiveRecord query immediately
original_bobs = User.where first_name: 'Bob'
# Assume this deletes a Bob:
User.destroy 123
# Now I'd like to see user 123 in this list:
puts original_bobs
@davetapley
Copy link
Author

To replicate this in the console I've been suffixing line 1 with ;, to prevent original_bobs being evaluated.
If I do so then I only see the User Load.. SQL after the puts statement, and as expected user 123 is gone (which is what I don't want to see).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment