Today I Learned

hashrocket A Hashrocket project

Rails console sandbox

We can open rails console with a flag to enable --sandbox. That surrounds the whole rails console session into a database transaction that gets rolled back on exit.

bundle exec rails console --sandbox

This way we can play around with data and all the changes will go away after existing the console.

h/t @mattpolito

See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.