mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix typos [ci-skip]
This commit is contained in:
parent
09194c9d69
commit
4ae7acf00d
9 changed files with 14 additions and 14 deletions
|
@ -836,7 +836,7 @@ You can use `ActionCable.createConsumer()` to connect to the cable
|
|||
server if `action_cable_meta_tag` is invoked in the layout. Otherwise, A path is
|
||||
specified as first argument to `createConsumer` (e.g. `ActionCable.createConsumer("/websocket")`).
|
||||
|
||||
For every instance of your server, you create and for every worker your server
|
||||
For every instance of your server you create, and for every worker your server
|
||||
spawns, you will also have a new instance of Action Cable, but the Redis or
|
||||
PostgreSQL adapter keeps messages synced across connections.
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ class AddUserRefToProducts < ActiveRecord::Migration[7.1]
|
|||
end
|
||||
```
|
||||
|
||||
This migration will create a `user_id` column, [references](#references) are a
|
||||
This migration will create a `user_id` column. [References](#references) are a
|
||||
shorthand for creating columns, indexes, foreign keys or even polymorphic
|
||||
association columns.
|
||||
|
||||
|
@ -556,7 +556,7 @@ If the `from_table` column name cannot be derived from the `to_table` name,
|
|||
you can use the `:column` option. Use the `:primary_key` option if the
|
||||
referenced primary key is not `:id`.
|
||||
|
||||
For example add a foreign key on `articles.reviewer` referencing `authors.email`:
|
||||
For example, to add a foreign key on `articles.reviewer` referencing `authors.email`:
|
||||
|
||||
```ruby
|
||||
add_foreign_key :articles, :authors, column: :reviewer, primary_key: :email
|
||||
|
|
|
@ -3788,7 +3788,7 @@ t.advance(seconds: 1)
|
|||
# => Sun Mar 28 03:00:00 +0200 2010
|
||||
```
|
||||
|
||||
* If [`since`][Time#since] or [`ago`][Time#ago] jump to a time that can't be expressed with `Time` a `DateTime` object is returned instead.
|
||||
* If [`since`][Time#since] or [`ago`][Time#ago] jumps to a time that can't be expressed with `Time` a `DateTime` object is returned instead.
|
||||
|
||||
[Time#ago]: https://api.rubyonrails.org/classes/Time.html#method-i-ago
|
||||
[Time#change]: https://api.rubyonrails.org/classes/Time.html#method-i-change
|
||||
|
|
|
@ -156,7 +156,7 @@ This will do three main things for you:
|
|||
If you want to take an existing application and make it an API one, read the
|
||||
following steps.
|
||||
|
||||
In `config/application.rb` add the following line at the top of the `Application`
|
||||
In `config/application.rb`, add the following line at the top of the `Application`
|
||||
class definition:
|
||||
|
||||
```ruby
|
||||
|
|
|
@ -299,7 +299,7 @@ NOTE: Notice that in this example we used the `cache_key_with_version` method, s
|
|||
Consider this example, which stores a list of Active Record objects representing superusers in the cache:
|
||||
|
||||
```ruby
|
||||
# super_admins is an expensive SQL query, so don't run it too often
|
||||
# super_admins is an expensive SQL query, so don't run it too often
|
||||
Rails.cache.fetch("super_admin_users", expires_in: 12.hours) do
|
||||
User.super_admins.to_a
|
||||
end
|
||||
|
@ -312,7 +312,7 @@ cache stores that reload code when you make changes.
|
|||
Instead, cache the ID or some other primitive data type. For example:
|
||||
|
||||
```ruby
|
||||
# super_admins is an expensive SQL query, so don't run it too often
|
||||
# super_admins is an expensive SQL query, so don't run it too often
|
||||
ids = Rails.cache.fetch("super_admin_user_ids", expires_in: 12.hours) do
|
||||
User.super_admins.pluck(:id)
|
||||
end
|
||||
|
|
|
@ -319,7 +319,7 @@ Configures lookup path for encrypted credentials.
|
|||
|
||||
Configures lookup path for encryption key.
|
||||
|
||||
#### `secret_key_base``
|
||||
#### `secret_key_base`
|
||||
|
||||
Is used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get a random generated key in test and development environments, other environments should set one in `config/credentials.yml.enc`.
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -2776,7 +2776,7 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
|
|||
|
||||
* `engines_blank_point`: Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run.
|
||||
|
||||
* `add_generator_templates`: Finds templates for generators at `lib/templates` for the application, railties, and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference.
|
||||
* `add_generator_templates`: Finds templates for generators at `lib/templates` for the application, railties, and engines, and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference.
|
||||
|
||||
* `ensure_autoload_once_paths_as_subset`: Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised.
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ Please check its [documentation](https://github.com/ruby/debug) for usage.
|
|||
|
||||
By default, a debugging session will start after the `debug` library is required, which happens when your app boots. But don't worry, the session won't interfere your program.
|
||||
|
||||
To enter the debugging session, you can use `binding.break` and its aliases: `binding.b` and `debugger`. The following examples will use `debugger`:
|
||||
To enter the debugging session, you can use `binding.break` and its aliases: `binding.b` and `debugger`. The following examples will use `debugger`:
|
||||
|
||||
```rb
|
||||
class PostsController < ApplicationController
|
||||
|
|
|
@ -809,7 +809,7 @@ Let's say we want to render a form with a set of fields for each of a person's a
|
|||
<% end %>
|
||||
```
|
||||
|
||||
Assuming the person had two addresses, with ids 23 and 45 this would create output similar to this:
|
||||
Assuming the person had two addresses with ids 23 and 45, this would create output similar to this:
|
||||
|
||||
```html
|
||||
<form accept-charset="UTF-8" action="/people/1" method="post">
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in a new issue