Link method names to API docs [ci-skip]

Note that some of these method names are already linked elsewhere in
their respective guides, hence no need for additional reference URLs.
This commit is contained in:
Jonathan Hefner 2022-02-11 12:41:03 -06:00
parent 56d8d103d4
commit 04110b2822
3 changed files with 8 additions and 8 deletions

View File

@ -548,7 +548,7 @@ While it's not required you might want to add foreign key constraints to
add_foreign_key :articles, :authors
```
This `add_foreign_key` call adds a new constraint to the `articles` table.
This [`add_foreign_key`][] call adds a new constraint to the `articles` table.
The constraint guarantees that a row in the `authors` table exists where
the `id` column matches the `articles.author_id`.
@ -562,8 +562,8 @@ 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`
are described in the [`add_foreign_key`][] API.
`add_foreign_key` also supports options such as `name`, `on_delete`,
`if_not_exists`, `validate`, and `deferrable`.
NOTE: Active Record only supports single column foreign keys. `execute` and
`structure.sql` are required to use composite foreign keys. See
@ -579,8 +579,6 @@ remove_foreign_key :accounts, :branches
remove_foreign_key :accounts, column: :owner_id
```
[`add_foreign_key`]: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_foreign_key
### When Helpers aren't Enough
If the helpers provided by Active Record aren't enough you can use the [`execute`][]

View File

@ -1325,7 +1325,7 @@ time_range = (Time.now.midnight - 1.day)..Time.now.midnight
Customer.joins(:orders).where(orders: { created_at: time_range }).distinct
```
For more advanced conditions or to reuse an existing named scope, `Relation#merge` may be used. First, let's add a new named scope to the `Order` model:
For more advanced conditions or to reuse an existing named scope, [`merge`][] may be used. First, let's add a new named scope to the `Order` model:
```ruby
class Order < ApplicationRecord
@ -1337,7 +1337,7 @@ class Order < ApplicationRecord
end
```
Now we can use `Relation#merge` to merge in the `created_in_time_range` scope:
Now we can use `merge` to merge in the `created_in_time_range` scope:
```ruby
time_range = (Time.now.midnight - 1.day)..Time.now.midnight

View File

@ -391,7 +391,7 @@ The articles resource here will have the following routes generated for it:
| PATCH/PUT | /articles/:id(.:format) | articles#update | article_path |
| DELETE | /articles/:id(.:format) | articles#destroy | article_path |
The `shallow` method of the DSL creates a scope inside of which every nesting is shallow. This generates the same routes as the previous example:
The [`shallow`][] method of the DSL creates a scope inside of which every nesting is shallow. This generates the same routes as the previous example:
```ruby
shallow do
@ -447,6 +447,8 @@ The comments resource here will have the following routes generated for it:
| PATCH/PUT | /comments/:id(.:format) | comments#update | sekret_comment_path |
| DELETE | /comments/:id(.:format) | comments#destroy | sekret_comment_path |
[`shallow`]: https://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-shallow
### Routing Concerns
Routing concerns allow you to declare common routes that can be reused inside other resources and routes. To define a concern, use a [`concern`][] block: