aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2018-12-15 11:23:52 +0900
committerGitHub <noreply@github.com>2018-12-15 11:23:52 +0900
commitf23cdd4f830d268d8f39e5b9b4e67b47a43a7973 (patch)
tree4a6906e12530e6cb5cdfc833a9c9975e885b26fb /guides
parentadb0c7bc5116e0f6020a4ec32b7e19ea8b26f1ec (diff)
parent8b0d29bcf2a62227e85a57cf8d5dc9fbefb5274a (diff)
downloadrails-f23cdd4f830d268d8f39e5b9b4e67b47a43a7973.tar.gz
rails-f23cdd4f830d268d8f39e5b9b4e67b47a43a7973.tar.bz2
rails-f23cdd4f830d268d8f39e5b9b4e67b47a43a7973.zip
Merge pull request #32872 from utilum/soften_migrations_guide_generator_section
Expand intro to generator in Migrations Guide
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 4d195988f8..905c76e5c1 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -126,7 +126,7 @@ generator to handle making it for you:
$ rails generate migration AddPartNumberToProducts
```
-This will create an empty but appropriately named migration:
+This will create an appropriately named empty migration:
```ruby
class AddPartNumberToProducts < ActiveRecord::Migration[5.0]
@@ -135,9 +135,14 @@ class AddPartNumberToProducts < ActiveRecord::Migration[5.0]
end
```
-If the migration name is of the form "AddXXXToYYY" or "RemoveXXXFromYYY" and is
-followed by a list of column names and types then a migration containing the
-appropriate `add_column` and `remove_column` statements will be created.
+This generator can do much more than append a timestamp to the file name.
+Based on naming conventions and additional (optional) arguments it can
+also start fleshing out the migration.
+
+If the migration name is of the form "AddColumnToTable" or
+"RemoveColumnFromTable" and is followed by a list of column names and
+types then a migration containing the appropriate `add_column` and
+`remove_column` statements will be created.
```bash
$ rails generate migration AddPartNumberToProducts part_number:string