This guide covers different ways to retrieve data from the database using Active Record.
After reading this guide, you will know:
?How to find records using a variety of methods and conditions.
?How to specify the order, retrieved attributes,grouping, and other properties of the found records.
? How to use eager loading(预先积极加载) to reduce the number of database queries needed for data retrieval.
? How to use dynamic finder methods.
? How to use method chaining to use multiple Active Record methods together.? How to check for the existence of particular records
? How to perform to do sth useful or difficult various calculations on Active Record models.
? How to run EXPLAIN on relations.(如何在关联上跑explain命令)