mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #38050 from p8/guides/command-rails-generate
Don't use rails command shortcuts in guides [ci skip]
This commit is contained in:
commit
008c4669cc
4 changed files with 6 additions and 6 deletions
|
@ -258,7 +258,7 @@ For more `add_reference` options, visit the [API documentation](https://api.ruby
|
|||
There is also a generator which will produce join tables if `JoinTable` is part of the name:
|
||||
|
||||
```bash
|
||||
$ rails g migration CreateJoinTableCustomerProduct customer product
|
||||
$ rails generate migration CreateJoinTableCustomerProduct customer product
|
||||
```
|
||||
|
||||
will produce the following migration:
|
||||
|
|
|
@ -167,7 +167,7 @@ For example the `animals` database would look in the `db/animals_migrate` direct
|
|||
so that the file is generated in the correct directory. The command can be run like so:
|
||||
|
||||
```bash
|
||||
$ rails g migration CreateDogs name:string --database animals
|
||||
$ rails generate migration CreateDogs name:string --database animals
|
||||
```
|
||||
|
||||
## Activating automatic connection switching
|
||||
|
|
|
@ -486,7 +486,7 @@ The value of `autoload_paths` can be inspected. In a just-generated application
|
|||
it is (edited):
|
||||
|
||||
```bash
|
||||
$ rails r 'puts ActiveSupport::Dependencies.autoload_paths'
|
||||
$ rails runner 'puts ActiveSupport::Dependencies.autoload_paths'
|
||||
.../app/assets
|
||||
.../app/channels
|
||||
.../app/controllers
|
||||
|
@ -1226,7 +1226,7 @@ been loaded but `app/models/hotel/image.rb` hasn't, Ruby does not find `Image`
|
|||
in `Hotel`, but it does in `Object`:
|
||||
|
||||
```bash
|
||||
$ rails r 'Image; p Hotel::Image' 2>/dev/null
|
||||
$ rails runner 'Image; p Hotel::Image' 2>/dev/null
|
||||
Image # NOT Hotel::Image!
|
||||
```
|
||||
|
||||
|
|
|
@ -202,7 +202,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 article`, won't be called `Article`, but
|
||||
to `rails generate model`, such as `rails generate model article`, won't be called `Article`, but
|
||||
instead be namespaced and called `Blorgh::Article`. In addition, the table for the
|
||||
model is namespaced, becoming `blorgh_articles`, rather than simply `articles`.
|
||||
Similar to the model namespacing, a controller called `ArticlesController` becomes
|
||||
|
@ -845,7 +845,7 @@ of associating the records in the `blorgh_articles` table with the records in th
|
|||
To generate this new column, run this command within the engine:
|
||||
|
||||
```bash
|
||||
$ rails g migration add_author_id_to_blorgh_articles author_id:integer
|
||||
$ rails generate migration add_author_id_to_blorgh_articles author_id:integer
|
||||
```
|
||||
|
||||
NOTE: Due to the migration's name and the column specification after it, Rails
|
||||
|
|
Loading…
Reference in a new issue