aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorBrooks Reese <brooksreese@gmail.com>2015-08-08 14:37:21 -0500
committerBrooks Reese <brooksreese@gmail.com>2015-08-08 14:37:21 -0500
commit4445e791575c95ab6b29208cb000ddf4cd2ee2de (patch)
tree2f418852648c429cd8df5dc2c67e29d1d68b9960 /guides
parent752432e82f3032e96ba609b65437cd8e8b8d3939 (diff)
downloadrails-4445e791575c95ab6b29208cb000ddf4cd2ee2de.tar.gz
rails-4445e791575c95ab6b29208cb000ddf4cd2ee2de.tar.bz2
rails-4445e791575c95ab6b29208cb000ddf4cd2ee2de.zip
[ci skip] Give in-depth explanation of migrations vs. seeds.rb
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_migrations.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/guides/source/active_record_migrations.md b/guides/source/active_record_migrations.md
index 980dfe6953..4e5902fb3d 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -1004,7 +1004,10 @@ such features, the `execute` method can be used to execute arbitrary SQL.
Migrations and Seed Data
------------------------
-Some people use migrations to add data to the database:
+The main purpose of Rails' migration feature is to issue commands that modify the
+schema using a consistent process. Migrations can also be used
+to add or modify data. This is useful in an existing database that can't be destroyed
+and recreated, such as a production database.
```ruby
class AddInitialProducts < ActiveRecord::Migration
@@ -1020,9 +1023,11 @@ class AddInitialProducts < ActiveRecord::Migration
end
```
-However, Rails has a 'seeds' feature that should be used for seeding a database
-with initial data. It's a really simple feature: just fill up `db/seeds.rb`
-with some Ruby code, and run `rake db:seed`:
+To add initial data after a database is created, Rails has a built-in
+'seeds' feature that makes the process quick and easy. This is especially
+useful when reloading the database frequently in development and test environments.
+It's easy to get started with this feature: just fill up `db/seeds.rb` with some
+Ruby code, and run `rake db:seed`:
```ruby
5.times do |i|