May 2025
Intermediate to advanced
270 pages
6h 55m
English
A common pattern in this book will be to describe the default behavior of ActiveRecord (and more generally, Rails), explain why it was chosen as the default, and finally, describe the cases in which taking a custom path makes sense. This is certainly the case for the position ActiveRecord takes by default when fetching from the database. I call this, “wide fetches.”
What is a “wide fetch,” you ask? Demonstrating this is as simple as doing any query using ActiveRecord. For example, let’s use the Rails console to fetch one film:
| | moviestore(main):001:0> Film.limit(1) |
| | Film Load (7.3ms) SELECT `films`.* FROM `films` /* loading for pp */ LIMIT 1 |
Notice the ...
Read now
Unlock full access