Last Updated: March 15, 2021
·
768
· rbmrclo

Hack safely from your rails console

Sometimes, you want to test out some code on production without affecting the database. You can add the --sandbox parameter and all your modifications to the database will be rolled back when you exit the console.

rails console --sandbox  # Rails 3 || 4
script/console --sandbox # Rails 2

Source: http://guides.rubyonrails.org/command_line.html#rails-console