aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/engines.md
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/engines.md')
-rw-r--r--guides/source/engines.md26
1 files changed, 13 insertions, 13 deletions
diff --git a/guides/source/engines.md b/guides/source/engines.md
index 8f9ba0995f..724c3d9021 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -73,13 +73,13 @@ options as appropriate to the need. For the "blorgh" example, you will need to
create a "mountable" engine, running this command in a terminal:
```bash
-$ rails plugin new blorgh --mountable
+$ bin/rails plugin new blorgh --mountable
```
The full list of options for the plugin generator may be seen by typing:
```bash
-$ rails plugin --help
+$ bin/rails plugin --help
```
The `--full` option tells the generator that you want to create an engine,
@@ -197,7 +197,7 @@ within the `Engine` class definition. Without it, classes generated in an engine
**may** conflict with an application.
What this isolation of the namespace means is that a model generated by a call
-to `rails g model`, such as `rails g model post`, won't be called `Post`, but
+to `bin/rails g model`, such as `bin/rails g model post`, won't be called `Post`, but
instead be namespaced and called `Blorgh::Post`. In addition, the table for the
model is namespaced, becoming `blorgh_posts`, rather than simply `posts`.
Similar to the model namespacing, a controller called `PostsController` becomes
@@ -253,7 +253,7 @@ This means that you will be able to generate new controllers and models for this
engine very easily by running commands like this:
```bash
-rails g model
+$ bin/rails g model
```
Keep in mind, of course, that anything generated with these commands inside of
@@ -293,7 +293,7 @@ The first thing to generate for a blog engine is the `Post` model and related
controller. To quickly generate this, you can use the Rails scaffold generator.
```bash
-$ rails generate scaffold post title:string text:text
+$ bin/rails generate scaffold post title:string text:text
```
This command will output this information:
@@ -451,7 +451,7 @@ From the application root, run the model generator. Tell it to generate a
and `text` text column.
```bash
-$ rails generate model Comment post_id:integer text:text
+$ bin/rails generate model Comment post_id:integer text:text
```
This will output the following:
@@ -471,7 +471,7 @@ called `Blorgh::Comment`. Now run the migration to create our blorgh_comments
table:
```bash
-$ rake db:migrate
+$ bin/rake db:migrate
```
To show the comments on a post, edit `app/views/blorgh/posts/show.html.erb` and
@@ -545,7 +545,7 @@ The route now exists, but the controller that this route goes to does not. To
create it, run this command from the application root:
```bash
-$ rails g controller comments
+$ bin/rails g controller comments
```
This will generate the following things:
@@ -682,14 +682,14 @@ engine's models can query them correctly. To copy these migrations into the
application use this command:
```bash
-$ rake blorgh:install:migrations
+$ bin/rake blorgh:install:migrations
```
If you have multiple engines that need migrations copied over, use
`railties:install:migrations` instead:
```bash
-$ rake railties:install:migrations
+$ bin/rake railties:install:migrations
```
This command, when run for the first time, will copy over all the migrations
@@ -810,7 +810,7 @@ of associating the records in the `blorgh_posts` table with the records in the
To generate this new column, run this command within the engine:
```bash
-$ rails g migration add_author_id_to_blorgh_posts author_id:integer
+$ bin/rails g migration add_author_id_to_blorgh_posts author_id:integer
```
NOTE: Due to the migration's name and the column specification after it, Rails
@@ -822,7 +822,7 @@ This migration will need to be run on the application. To do that, it must first
be copied using this command:
```bash
-$ rake blorgh:install:migrations
+$ bin/rake blorgh:install:migrations
```
Notice that only _one_ migration was copied over here. This is because the first
@@ -839,7 +839,7 @@ with the same name already exists. Copied migration
Run the migration using:
```bash
-$ rake db:migrate
+$ bin/rake db:migrate
```
Now with all the pieces in place, an action will take place that will associate