Skip to content

Commit a46e47a

Browse files
Rails: Default to "sandbox" mode when accessing production-like environments (#747)
In an effort to avoid mutating production data, we recommend using "sandbox" mode when using `rails console`. If you need to [manipulate data][data migrate], consider running a custom Rake task, or use [maintenance_tasks][]. [data migrate]: https://guides.rubyonrails.org/active_record_migrations.html#data-migrations [maintenance_tasks]: https://github.com/Shopify/maintenance_tasks
1 parent 16479f2 commit a46e47a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rails/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ Guidance on ActiveRecord, ActiveModel, and other model objects.
8181
- Use `db/seeds.rb` for data that is required in all environments.
8282
- Use `development:db:seed` rake task for development environment seed data. [Example](/rails/how-to/seed-data.md).
8383

84+
## Security
85+
86+
- Set [config.sandbox_by_default][sandbox] to `true` in production-like environments to avoid accidental writing to the production database.
87+
88+
[sandbox]: https://guides.rubyonrails.org/configuring.html#config-sandbox-by-default
89+
8490
## Migrations
8591

8692
[Sample](migration.rb)

0 commit comments

Comments
 (0)