Improve "skimmability" of truncation options

There aren't any specific examples of setting these options, and it took us a bit
to understand they were similar to the options above.

Signed-off-by: Salman Hossain <salman.hossain@greenhouse.io>
This commit is contained in:
Mark McDonald 2018-11-05 16:46:54 -05:00 committed by Salman Hossain
parent 14626296ef
commit 28f4bbee4d
1 changed files with 1 additions and 1 deletions

View File

@ -202,7 +202,7 @@ DatabaseCleaner.strategy = :transaction
### Additional ActiveRecord options for Truncation
The following options are available for ActiveRecord's `:truncation` strategy _only_ for MySQL and Postgres.
The following options are available for ActiveRecord's `:truncation` strategy _only_ for MySQL and Postgres. You set them the same as the other truncation options above (e.g. `DatabaseCleaner.strategy = :truncation, {:pre_count => true}`).
* `:pre_count` - When set to `true` this will check each table for existing rows before truncating it. This can speed up test suites when many of the tables to be truncated are never populated. Defaults to `:false`. (Also, see the section on [What strategy is fastest?](#what-strategy-is-fastest))
* `:reset_ids` - This only matters when `:pre_count` is used, and it will make sure that a tables auto-incrementing id is reset even if there are no rows in the table (e.g. records were created in the test but also removed before DatabaseCleaner gets to it). Defaults to `true`.