Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This method explicitly loads the records and then returns `self`. Rather than deciding between "do I want an array or a relation?", most people are actually asking themselves "do I want to eager load or lazy load?" Therefore, this method provides a way to explicitly eager-load without having to switch from a `Relation` to an array. Example: @posts = Post.where(published: true).load
- Loading branch information
1 parent
4efebde
commit 437851e
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
437851e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just
alias load to_a
? What is the point in not returning an array? I believe it should be easy and natural to get the an array of all users without a type-conversion style call.437851e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jon, we can talk about it in Basecamp if you want.