You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ruby_on_rails/advanced_forms_and_activerecord/active_record_queries.md
+21-18Lines changed: 21 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -234,24 +234,27 @@ Sometimes, you just can't get ActiveRecord to do what you want it to. In that c
234
234
235
235
This was a lot of material, but you should have a healthy appreciation for the breadth of things that you can do with Active Record. At the most basic level, though, you can do pretty much anything you can in SQL by using Active Record query methods. You'll get a chance to use some of these newfound query methods in future projects and others will come up when you're building things on your own.
236
236
237
-
### Additional resources
238
-
This section contains helpful links to other content. It isn't required, so consider it supplemental.
237
+
### Knowledge check
239
238
240
-
*[SO post on Using Scopes vs Class Methods](http://stackoverflow.com/questions/5899765/activerecord-rails-3-scope-vs-class-method)
241
-
*[Platformatec diving more into the use case of scopes vs class methods](http://blog.plataformatec.com.br/2013/02/active-record-scopes-vs-class-methods/)
*[Introduction to the N+1 Problem](https://www.youtube.com/watch?v=Xr3hZdIwuSw)
244
-
*[N+1 Problem: Eager Loading with Active Record](https://www.youtube.com/watch?v=wLMRzdOztUY)
245
-
*[N+1 Problem: Optimized Counts with Joins and Custom Select](https://www.youtube.com/watch?v=rJg3I-leoo4)
246
-
*[Speed up ActiveRecord with a little tweaking](https://blog.codeship.com/speed-up-activerecord/)
247
-
*[A useful gem that identifies N+1 queries](https://github.com/flyerhzm/bullet)
239
+
This section contains questions for you to check your understanding of this lesson on your own. If you’re having trouble answering a question, click it and review the material it links to.
248
240
249
-
### Knowledge check
241
+
- <aclass='knowledge-check-link'href='#relations-and-lazy-evaluation'>How does lazy evaluation help make Active Record more efficient?</a>
242
+
- <aclass='knowledge-check-link'href='#checking-for-existence'>How do you check whether a database already contains a record?</a>
243
+
- <aclass='knowledge-check-link'href='#more-assorted-querying-knowledge'>What is the difference between a `#where` query and a `#find` query?</a>
244
+
- <aclass='knowledge-check-link'href='#joins'>How do you join tables together in Rails?</a>
245
+
- <aclass='knowledge-check-link'href='#n1-queries-and-eager-loading'>What is an example of an N+1 query?</a>
246
+
- <aclass='knowledge-check-link'href='#n1-queries-and-eager-loading'>What method is used to deal with an N+1 query?</a>
247
+
- <aclass='knowledge-check-link'href='#scopes'>When would you use a class method in place of a scope?</a>
248
+
249
+
### Additional resources
250
+
251
+
This section contains helpful links to related content. It isn’t required, so consider it supplemental.
250
252
251
-
* <aclass='knowledge-check-link'href='#relations-and-lazy-evaluation'>How does lazy evaluation help make Active Record more efficient?</a>
252
-
* <aclass='knowledge-check-link'href='#checking-for-existence'>How do you check whether a database already contains a record?</a>
253
-
* <aclass='knowledge-check-link'href='#more-assorted-querying-knowledge'>What is the difference between a `#where` query and a `#find` query?</a>
254
-
* <aclass='knowledge-check-link'href='#joins'>How do you join tables together in Rails?</a>
255
-
* <aclass='knowledge-check-link'href='#n1-queries-and-eager-loading'>What is an example of an N+1 query?</a>
256
-
* <aclass='knowledge-check-link'href='#n1-queries-and-eager-loading'>What method is used to deal with an N+1 query?</a>
257
-
* <aclass='knowledge-check-link'href='#scopes'>When would you use a class method in place of a scope?</a>
253
+
-[SO post on Using Scopes vs Class Methods](http://stackoverflow.com/questions/5899765/activerecord-rails-3-scope-vs-class-method)
254
+
-[Platformatec diving more into the use case of scopes vs class methods](http://blog.plataformatec.com.br/2013/02/active-record-scopes-vs-class-methods/)
0 commit comments