diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 23:07:57 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 23:07:57 +0000 |
commit | d7845d2919aecdfe5def976215207e06ec13e137 (patch) | |
tree | a254411df8fa5fc6f9d712c20f457b61e5069a63 /railties/bin/console_sandbox.rb | |
parent | b008b6f1946bdf6c922f62f9fd587fa74ad6af2a (diff) | |
download | rails-d7845d2919aecdfe5def976215207e06ec13e137.tar.gz rails-d7845d2919aecdfe5def976215207e06ec13e137.tar.bz2 rails-d7845d2919aecdfe5def976215207e06ec13e137.zip |
Added --sandbox option to script/console that'll roll back all changes made to the database when you quit #672 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@701 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/bin/console_sandbox.rb')
-rw-r--r-- | railties/bin/console_sandbox.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/bin/console_sandbox.rb b/railties/bin/console_sandbox.rb new file mode 100644 index 0000000000..80f3dbc223 --- /dev/null +++ b/railties/bin/console_sandbox.rb @@ -0,0 +1,6 @@ +ActiveRecord::Base.lock_mutex +ActiveRecord::Base.connection.begin_db_transaction +at_exit do + ActiveRecord::Base.connection.rollback_db_transaction + ActiveRecord::Base.unlock_mutex +end |