Created
May 21, 2013 15:59
-
-
Save davetapley/5620948 to your computer and use it in GitHub Desktop.
Execute ActiveRecord query immediately
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To replicate this in the console I've been suffixing line 1 with
;
, to preventoriginal_bobs
being evaluated.If I do so then I only see the
User Load..
SQL after theputs
statement, and as expected user 123 is gone (which is what I don't want to see).