mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add Oxford commas [ci-skip]
This commit is contained in:
parent
a84788e117
commit
c01b48e5fa
6 changed files with 12 additions and 12 deletions
|
@ -252,7 +252,7 @@ end
|
|||
```
|
||||
|
||||
This migration will create a `user_id` column. [References](#references) are a
|
||||
shorthand for creating columns, indexes, foreign keys or even polymorphic
|
||||
shorthand for creating columns, indexes, foreign keys, or even polymorphic
|
||||
association columns.
|
||||
|
||||
There is also a generator which will produce join tables if `JoinTable` is part of the name:
|
||||
|
@ -281,7 +281,7 @@ end
|
|||
|
||||
### Model Generators
|
||||
|
||||
The model, resource and scaffold generators will create migrations appropriate for adding
|
||||
The model, resource, and scaffold generators will create migrations appropriate for adding
|
||||
a new model. This migration will already contain instructions for creating the
|
||||
relevant table. If you tell Rails what columns you want, then statements for
|
||||
adding these columns will also be created. For example, running:
|
||||
|
@ -340,7 +340,7 @@ get to work!
|
|||
### Creating a Table
|
||||
|
||||
The [`create_table`][] method is one of the most fundamental, but most of the time,
|
||||
will be generated for you from using a model, resource or scaffold generator. A typical
|
||||
will be generated for you from using a model, resource, or scaffold generator. A typical
|
||||
use would be
|
||||
|
||||
```ruby
|
||||
|
@ -562,7 +562,7 @@ For example, to add a foreign key on `articles.reviewer` referencing `authors.em
|
|||
add_foreign_key :articles, :authors, column: :reviewer, primary_key: :email
|
||||
```
|
||||
|
||||
Options such as `name`, `on_delete`, `if_not_exists`, `validate` and `deferrable`
|
||||
Options such as `name`, `on_delete`, `if_not_exists`, `validate`, and `deferrable`
|
||||
are described in the [`add_foreign_key`][] API.
|
||||
|
||||
NOTE: Active Record only supports single column foreign keys. `execute` and
|
||||
|
|
|
@ -3553,7 +3553,7 @@ date.end_of_minute # => Mon Jun 07 19:55:59 +0200 2010
|
|||
|
||||
`beginning_of_minute` is aliased to [`at_beginning_of_minute`][DateTime#at_beginning_of_minute].
|
||||
|
||||
INFO: `beginning_of_hour`, `end_of_hour`, `beginning_of_minute` and `end_of_minute` are implemented for `Time` and `DateTime` but **not** `Date` as it does not make sense to request the beginning or end of an hour or minute on a `Date` instance.
|
||||
INFO: `beginning_of_hour`, `end_of_hour`, `beginning_of_minute`, and `end_of_minute` are implemented for `Time` and `DateTime` but **not** `Date` as it does not make sense to request the beginning or end of an hour or minute on a `Date` instance.
|
||||
|
||||
NOTE: Defined in `active_support/core_ext/date_time/calculations.rb`.
|
||||
|
||||
|
@ -3808,7 +3808,7 @@ NOTE: Defined in `active_support/core_ext/time/calculations.rb`.
|
|||
[DateAndTime::Calculations#tomorrow?]: https://api.rubyonrails.org/classes/DateAndTime/Calculations.html#method-i-tomorrow-3F
|
||||
[DateAndTime::Calculations#yesterday?]: https://api.rubyonrails.org/classes/DateAndTime/Calculations.html#method-i-yesterday-3F
|
||||
|
||||
#### `all_day`, `all_week`, `all_month`, `all_quarter` and `all_year`
|
||||
#### `all_day`, `all_week`, `all_month`, `all_quarter`, and `all_year`
|
||||
|
||||
The method [`all_day`][DateAndTime::Calculations#all_day] returns a range representing the whole day of the current time.
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ Defines the CSS compressor to use. It is set by default by `sass-rails`. The uni
|
|||
|
||||
#### `config.assets.js_compressor`
|
||||
|
||||
Defines the JavaScript compressor to use. Possible values are `:terser`, `:closure`, `:uglifier` and `:yui`, which require the use of the `terser`, `closure-compiler`, `uglifier` or `yui-compressor` gems respectively.
|
||||
Defines the JavaScript compressor to use. Possible values are `:terser`, `:closure`, `:uglifier`, and `:yui`, which require the use of the `terser`, `closure-compiler`, `uglifier`, or `yui-compressor` gems respectively.
|
||||
|
||||
#### `config.assets.gzip`
|
||||
|
||||
|
@ -1884,7 +1884,7 @@ The default value depends on the `config.load_defaults` target version:
|
|||
|
||||
Specifies what serializer the `MessageEncryptor` class will use by default.
|
||||
|
||||
Options are `:json`, `:hybrid` and `:marshal`. `:hybrid` uses the `JsonWithMarshalFallback` class.
|
||||
Options are `:json`, `:hybrid`, and `:marshal`. `:hybrid` uses the `JsonWithMarshalFallback` class.
|
||||
|
||||
The default value depends on the `config.load_defaults` target version:
|
||||
|
||||
|
@ -2042,7 +2042,7 @@ By default, this is defined as:
|
|||
config.active_storage.analyzers = [ActiveStorage::Analyzer::ImageAnalyzer::Vips, ActiveStorage::Analyzer::ImageAnalyzer::ImageMagick, ActiveStorage::Analyzer::VideoAnalyzer, ActiveStorage::Analyzer::AudioAnalyzer]
|
||||
```
|
||||
|
||||
The image analyzers can extract width and height of an image blob; the video analyzer can extract width, height, duration, angle, aspect ratio and presence/absence of video/audio channels of a video blob; the audio analyzer can extract duration and bit rate of an audio blob.
|
||||
The image analyzers can extract width and height of an image blob; the video analyzer can extract width, height, duration, angle, aspect ratio, and presence/absence of video/audio channels of a video blob; the audio analyzer can extract duration and bit rate of an audio blob.
|
||||
|
||||
#### `config.active_storage.previewers`
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ $ bin/rails generate scaffold User name:string
|
|||
create test/system/users_test.rb
|
||||
```
|
||||
|
||||
Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything; it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the `scaffold_controller` generator, which invokes `erb`, `test_unit` and `helper` generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication.
|
||||
Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything; it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the `scaffold_controller` generator, which invokes `erb`, `test_unit`, and `helper` generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication.
|
||||
|
||||
The next customization on the workflow will be to stop generating stylesheet and test fixture files for scaffolds altogether. We can achieve that by changing our configuration to the following:
|
||||
|
||||
|
|
|
@ -956,7 +956,7 @@ You can also specify a special size tag, in the format "{width}x{height}":
|
|||
<%= image_tag "home.gif", size: "50x20" %>
|
||||
```
|
||||
|
||||
In addition to the above special tags, you can supply a final hash of standard HTML options, such as `:class`, `:id` or `:name`:
|
||||
In addition to the above special tags, you can supply a final hash of standard HTML options, such as `:class`, `:id`, or `:name`:
|
||||
|
||||
```erb
|
||||
<%= image_tag "home.gif", alt: "Go Home",
|
||||
|
|
|
@ -89,7 +89,7 @@ Resource routing allows you to quickly declare all of the common routes for a gi
|
|||
|
||||
### Resources on the Web
|
||||
|
||||
Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as `GET`, `POST`, `PATCH`, `PUT` and `DELETE`. Each method is a request to perform an operation on the resource. A resource route maps a number of related requests to actions in a single controller.
|
||||
Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as `GET`, `POST`, `PATCH`, `PUT`, and `DELETE`. Each method is a request to perform an operation on the resource. A resource route maps a number of related requests to actions in a single controller.
|
||||
|
||||
When your Rails application receives an incoming request for:
|
||||
|
||||
|
|
Loading…
Reference in a new issue