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
Tweet