mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update "Active Record Associations" guide [ci skip]
- Make all `ActiveRecord::Base.find` as link - Remove redundant sentences "It also adds the additional condition that the object must be in the collection."
This commit is contained in:
parent
7d75599c87
commit
ff214c3715
1 changed files with 5 additions and 3 deletions
|
@ -1561,7 +1561,8 @@ The `collection.size` method returns the number of objects in the collection.
|
|||
|
||||
##### `collection.find(...)`
|
||||
|
||||
The `collection.find` method finds objects within the collection. It uses the same syntax and options as `ActiveRecord::Base.find`.
|
||||
The `collection.find` method finds objects within the collection. It uses the same syntax and options as
|
||||
[`ActiveRecord::Base.find`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find).
|
||||
|
||||
```ruby
|
||||
@available_book = @author.books.find(1)
|
||||
|
@ -2091,7 +2092,8 @@ The `collection.size` method returns the number of objects in the collection.
|
|||
|
||||
##### `collection.find(...)`
|
||||
|
||||
The `collection.find` method finds objects within the collection. It uses the same syntax and options as `ActiveRecord::Base.find`. It also adds the additional condition that the object must be in the collection.
|
||||
The `collection.find` method finds objects within the collection. It uses the same syntax and options as
|
||||
[`ActiveRecord::Base.find`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find).
|
||||
|
||||
```ruby
|
||||
@assembly = @part.assemblies.find(1)
|
||||
|
@ -2099,7 +2101,7 @@ The `collection.find` method finds objects within the collection. It uses the sa
|
|||
|
||||
##### `collection.where(...)`
|
||||
|
||||
The `collection.where` method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed. It also adds the additional condition that the object must be in the collection.
|
||||
The `collection.where` method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed.
|
||||
|
||||
```ruby
|
||||
@new_assemblies = @part.assemblies.where("created_at > ?", 2.days.ago)
|
||||
|
|
Loading…
Reference in a new issue