567.md 746 字节
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Mass inserting Rails models

> 原文:[https://docs.gitlab.com/ee/development/mass_insert.html](https://docs.gitlab.com/ee/development/mass_insert.html)

# Mass inserting Rails models[](#mass-inserting-rails-models "Permalink")

在运行[`rake setup`](rake_tasks.html)时设置环境变量[`MASS_INSERT=1`](rake_tasks.html#environment-variables)将创建数百万条记录,但是默认情况下, `root`用户看不到这些记录.

要使`root`用户可以看到任意数量的大容量插入项目,请在 rails 控制台中运行以下代码段.

```
u = User.find(1)
Project.last(100).each { |p| p.set_timestamps_for_create && p.add_maintainer(u, current_user: u) } # Change 100 to whatever number of projects you need access to 
```