Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos, grammar, and formatting [ci-skip] #40905

Merged
merged 1 commit into from Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion guides/source/2_3_release_notes.md
Expand Up @@ -14,7 +14,7 @@ There are two major changes in the architecture of Rails applications: complete

### Rack Integration

Rails has now broken with its CGI past, and uses Rack everywhere. This required and resulted in a tremendous number of internal changes (but if you use CGI, don't worry; Rails now supports CGI through a proxy interface.) Still, this is a major change to Rails internals. After upgrading to 2.3, you should test on your local environment and your production environment. Some things to test:
Rails has now broken with its CGI past, and uses Rack everywhere. This required and resulted in a tremendous number of internal changes (but if you use CGI, don't worry; Rails now supports CGI through a proxy interface). Still, this is a major change to Rails internals. After upgrading to 2.3, you should test on your local environment and your production environment. Some things to test:

* Sessions
* Cookies
Expand Down Expand Up @@ -227,6 +227,7 @@ render 'other_controller/action'
render 'show'
render :show
```

Rails chooses between file, template, and action depending on whether there is a leading slash, an embedded slash, or no slash at all in what's to be rendered. Note that you can also use a symbol instead of a string when rendering an action. Other rendering styles (`:inline`, `:text`, `:update`, `:nothing`, `:json`, `:xml`, `:js`) still require an explicit option.

### Application Controller Renamed
Expand Down
2 changes: 1 addition & 1 deletion guides/source/3_0_release_notes.md
Expand Up @@ -131,7 +131,7 @@ More information: - [Make Any Ruby Object Feel Like ActiveRecord](http://yehudak

### Controller Abstraction

Another big part of decoupling the core components was creating a base superclass that is separated from the notions of HTTP in order to handle rendering of views etc. This creation of `AbstractController` allowed `ActionController` and `ActionMailer` to be greatly simplified with common code removed from all these libraries and put into Abstract Controller.
Another big part of decoupling the core components was creating a base superclass that is separated from the notions of HTTP in order to handle rendering of views, etc. This creation of `AbstractController` allowed `ActionController` and `ActionMailer` to be greatly simplified with common code removed from all these libraries and put into Abstract Controller.

More Information: - [Rails Edge Architecture](http://yehudakatz.com/2009/06/11/rails-edge-architecture/)

Expand Down
4 changes: 2 additions & 2 deletions guides/source/3_1_release_notes.md
Expand Up @@ -221,7 +221,7 @@ Railties

* Added `Rack::Cache` to the default middleware stack.

* Engines received a major update - You can mount them at any path, enable assets, run generators etc.
* Engines received a major update - You can mount them at any path, enable assets, run generators, etc.

Action Pack
-----------
Expand Down Expand Up @@ -455,7 +455,7 @@ Active Record
```ruby
class FooMigration < ActiveRecord::Migration
def up # Not self.up
...
# ...
end
end
```
Expand Down
1 change: 0 additions & 1 deletion guides/source/3_2_release_notes.md
Expand Up @@ -462,7 +462,6 @@ Active Record
end

Post.table_name # => "special_posts"

```

Active Model
Expand Down
4 changes: 2 additions & 2 deletions guides/source/4_1_release_notes.md
Expand Up @@ -215,12 +215,12 @@ class Todo < ActiveRecord::Base
end

def latest_event
...
# ...
end

private
def some_internal_method
...
# ...
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions guides/source/5_2_release_notes.md
Expand Up @@ -126,7 +126,7 @@ Please refer to the [Changelog][railties] for detailed changes.
([Pull Request](https://github.com/rails/rails/pull/29534))

* Skip unused components when running `bin/rails app:update`.
If the initial app generation skipped Action Cable, Active Record etc.,
If the initial app generation skipped Action Cable, Active Record, etc.,
the update task honors those skips too.
([Pull Request](https://github.com/rails/rails/pull/29645))

Expand Down Expand Up @@ -180,8 +180,8 @@ Please refer to the [Changelog][railties] for detailed changes.
([Pull Request](https://github.com/rails/rails/pull/30633))

* `rails new` and `rails plugin new` get `Active Storage` by default.
Add ability to skip `Active Storage` with `--skip-active-storage`
and do so automatically when `--skip-active-record` is used.
Add ability to skip `Active Storage` with `--skip-active-storage`
and do so automatically when `--skip-active-record` is used.
([Pull Request](https://github.com/rails/rails/pull/30101))

Action Cable
Expand Down
3 changes: 1 addition & 2 deletions guides/source/action_cable_overview.md
Expand Up @@ -767,7 +767,7 @@ config.action_cable.worker_pool_size = 4
Also, note that your server must provide at least the same number of database
connections as you have workers. The default worker pool size is set to 4, so
that means you have to make at least 4 database connections available.
You can change that in `config/database.yml` through the `pool` attribute.
You can change that in `config/database.yml` through the `pool` attribute.

### Client side logging

Expand All @@ -779,7 +779,6 @@ import * as ActionCable from '@rails/actioncable'
ActionCable.logger.enabled = true
```


### Other Configurations

The other common option to configure is the log tags applied to the
Expand Down
54 changes: 27 additions & 27 deletions guides/source/action_controller_overview.md
Expand Up @@ -34,7 +34,7 @@ Controller Naming Convention

The naming convention of controllers in Rails favors pluralization of the last word in the controller's name, although it is not strictly required (e.g. `ApplicationController`). For example, `ClientsController` is preferable to `ClientController`, `SiteAdminsController` is preferable to `SiteAdminController` or `SitesAdminsController`, and so on.

Following this convention will allow you to use the default route generators (e.g. `resources`, etc) without needing to qualify each `:path` or `:controller`, and will keep named route helpers' usage consistent throughout your application. See [Layouts & Rendering Guide](layouts_and_rendering.html) for more details.
Following this convention will allow you to use the default route generators (e.g. `resources`, etc) without needing to qualify each `:path` or `:controller`, and will keep named route helpers' usage consistent throughout your application. See [Layouts and Rendering Guide](layouts_and_rendering.html) for more details.

NOTE: The controller naming convention differs from the naming convention of models, which are expected to be named in singular form.

Expand All @@ -59,7 +59,7 @@ def new
end
```

The [Layouts & Rendering Guide](layouts_and_rendering.html) explains this in more detail.
The [Layouts and Rendering Guide](layouts_and_rendering.html) explains this in more detail.

`ApplicationController` inherits from [`ActionController::Base`][], which defines a number of helpful methods. This guide will cover some of these, but if you're curious to see what's in there, you can see all of them in the [API documentation](https://api.rubyonrails.org/classes/ActionController.html) or in the source itself.

Expand Down Expand Up @@ -196,7 +196,7 @@ These options will be used as a starting point when generating URLs, so it's pos

If you define `default_url_options` in `ApplicationController`, as in the example above, these defaults will be used for all URL generation. The method can also be defined in a specific controller, in which case it only affects URLs generated there.

In a given request, the method is not actually called for every single generated URL; for performance reasons, the returned hash is cached, there is at most one invocation per request.
In a given request, the method is not actually called for every single generated URL. For performance reasons, the returned hash is cached, and there is at most one invocation per request.

### Strong Parameters

Expand Down Expand Up @@ -373,7 +373,7 @@ Your application has a session for each user in which you can store small amount

* [`ActionDispatch::Session::CookieStore`][] - Stores everything on the client.
* [`ActionDispatch::Session::CacheStore`][] - Stores the data in the Rails cache.
* `ActionDispatch::Session::ActiveRecordStore` - Stores the data in a database using Active Record. (require `activerecord-session_store` gem).
* `ActionDispatch::Session::ActiveRecordStore` - Stores the data in a database using Active Record (requires the `activerecord-session_store` gem).
* [`ActionDispatch::Session::MemCacheStore`][] - Stores the data in a memcached cluster (this is a legacy implementation; consider using CacheStore instead).

All session stores use a cookie to store a unique ID for each session (you must use a cookie, Rails will not allow you to pass the session ID in the URL as this is less secure).
Expand Down Expand Up @@ -487,7 +487,7 @@ To reset the entire session, use [`reset_session`][].

### The Flash

The flash is a special part of the session which is cleared with each request. This means that values stored there will only be available in the next request, which is useful for passing error messages etc.
The flash is a special part of the session which is cleared with each request. This means that values stored there will only be available in the next request, which is useful for passing error messages, etc.

The flash is accessed via the [`flash`][] method. Like the session, the flash is represented as a hash.

Expand Down Expand Up @@ -769,9 +769,9 @@ You can choose not to yield and build the response yourself, in which case the a

### Other Ways to Use Filters

While the most common way to use filters is by creating private methods and using *_action to add them, there are two other ways to do the same thing.
While the most common way to use filters is by creating private methods and using `before_action`, `after_action`, or `around_action` to add them, there are two other ways to do the same thing.

The first is to use a block directly with the *\_action methods. The block receives the controller as an argument. The `require_login` filter from above could be rewritten to use a block:
The first is to use a block directly with the `*_action` methods. The block receives the controller as an argument. The `require_login` filter from above could be rewritten to use a block:

```ruby
class ApplicationController < ActionController::Base
Expand Down Expand Up @@ -851,27 +851,27 @@ The Request and Response Objects

In every controller there are two accessor methods pointing to the request and the response objects associated with the request cycle that is currently in execution. The [`request`][] method contains an instance of [`ActionDispatch::Request`][] and the [`response`][] method returns a response object representing what is going to be sent back to the client.

[`ActionDispatch::Request`]: https://api.rubyonrails.org/classes/ActionDispatch/Request.html
[`request`]: https://api.rubyonrails.org/classes/ActionController/Base.html#method-i-request
[`response`]: https://api.rubyonrails.org/classes/ActionController/Base.html#method-i-response
[`ActionDispatch::Request`]: https://api.rubyonrails.org/classes/ActionDispatch/Request.html
[`request`]: https://api.rubyonrails.org/classes/ActionController/Base.html#method-i-request
[`response`]: https://api.rubyonrails.org/classes/ActionController/Base.html#method-i-response

### The `request` Object

The request object contains a lot of useful information about the request coming in from the client. To get a full list of the available methods, refer to the [Rails API documentation](https://api.rubyonrails.org/classes/ActionDispatch/Request.html) and [Rack Documentation](https://www.rubydoc.info/github/rack/rack/Rack/Request). Among the properties that you can access on this object are:

| Property of `request` | Purpose |
| ----------------------------------------- | -------------------------------------------------------------------------------- |
| host | The hostname used for this request. |
| domain(n=2) | The hostname's first `n` segments, starting from the right (the TLD). |
| format | The content type requested by the client. |
| method | The HTTP method used for the request. |
| get?, post?, patch?, put?, delete?, head? | Returns true if the HTTP method is GET/POST/PATCH/PUT/DELETE/HEAD. |
| headers | Returns a hash containing the headers associated with the request. |
| port | The port number (integer) used for the request. |
| protocol | Returns a string containing the protocol used plus "://", for example "http://". |
| query_string | The query string part of the URL, i.e., everything after "?". |
| remote_ip | The IP address of the client. |
| url | The entire URL used for the request. |
| `host` | The hostname used for this request. |
| `domain(n=2)` | The hostname's first `n` segments, starting from the right (the TLD). |
| `format` | The content type requested by the client. |
| `method` | The HTTP method used for the request. |
| `get?`, `post?`, `patch?`, `put?`, `delete?`, `head?` | Returns true if the HTTP method is GET/POST/PATCH/PUT/DELETE/HEAD. |
| `headers` | Returns a hash containing the headers associated with the request. |
| `port` | The port number (integer) used for the request. |
| `protocol` | Returns a string containing the protocol used plus "://", for example "http://". |
| `query_string` | The query string part of the URL, i.e., everything after "?". |
| `remote_ip` | The IP address of the client. |
| `url` | The entire URL used for the request. |

#### `path_parameters`, `query_parameters`, and `request_parameters`

Expand All @@ -887,12 +887,12 @@ The response object is not usually used directly, but is built up during the exe

| Property of `response` | Purpose |
| ---------------------- | --------------------------------------------------------------------------------------------------- |
| body | This is the string of data being sent back to the client. This is most often HTML. |
| status | The HTTP status code for the response, like 200 for a successful request or 404 for file not found. |
| location | The URL the client is being redirected to, if any. |
| content_type | The content type of the response. |
| charset | The character set being used for the response. Default is "utf-8". |
| headers | Headers used for the response. |
| `body` | This is the string of data being sent back to the client. This is most often HTML. |
| `status` | The HTTP status code for the response, like 200 for a successful request or 404 for file not found. |
| `location` | The URL the client is being redirected to, if any. |
| `content_type` | The content type of the response. |
| `charset` | The character set being used for the response. Default is "utf-8". |
| `headers` | Headers used for the response. |

#### Setting Custom Headers

Expand Down