diff --git a/README.md b/README.md index 07e5c58..e786f85 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Capybara Page Status Code](rails/capybara-page-status-code.md) - [Conditional Class Selectors in Haml](rails/conditional-class-selectors-in-haml.md) - [Creating Records of Has_One Associations](rails/creating-records-of-has-one-associations.md) +- [Pretend Generations](rails/pretend-generations.md) - [Show Pending Migrations](rails/show-pending-migrations.md) ### ruby diff --git a/rails/pretend-generations.md b/rails/pretend-generations.md new file mode 100644 index 0000000..5333b4b --- /dev/null +++ b/rails/pretend-generations.md @@ -0,0 +1,24 @@ +# Pretend Generations + +To get an idea of what a `rails generate` command is going to to +*generate*, you can do a dry run with the `-p` flag or +the `--pretend` flag. If you run + +``` +$ rails generate model post -p +``` + +then you will see the following output + +``` + invoke active_record + create db/migrate/20150513132556_create_posts.rb + create app/models/post.rb + invoke rspec + create spec/models/post_spec.rb + invoke factory_girl + create spec/factories/posts.rb +``` + +though those files will not have actually been created. You now know +precisely what rails will generate for you.