Skip to content

Commit 3cf0803

Browse files
Update active_record_queries lesson to reflect layout style guide
1 parent 9c41564 commit 3cf0803

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

ruby_on_rails/advanced_forms_and_activerecord/active_record_queries.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,27 @@ Sometimes, you just can't get ActiveRecord to do what you want it to. In that c
234234

235235
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.
236236

237-
### Additional resources
238-
This section contains helpful links to other content. It isn't required, so consider it supplemental.
237+
### Knowledge check
239238

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/)
242-
* [RailsCasts #22 Eager Loading](http://railscasts.com/episodes/22-eager-loading-revised)
243-
* [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.
248240

249-
### Knowledge check
241+
- <a class='knowledge-check-link' href='#relations-and-lazy-evaluation'>How does lazy evaluation help make Active Record more efficient?</a>
242+
- <a class='knowledge-check-link' href='#checking-for-existence'>How do you check whether a database already contains a record?</a>
243+
- <a class='knowledge-check-link' href='#more-assorted-querying-knowledge'>What is the difference between a `#where` query and a `#find` query?</a>
244+
- <a class='knowledge-check-link' href='#joins'>How do you join tables together in Rails?</a>
245+
- <a class='knowledge-check-link' href='#n1-queries-and-eager-loading'>What is an example of an N+1 query?</a>
246+
- <a class='knowledge-check-link' href='#n1-queries-and-eager-loading'>What method is used to deal with an N+1 query?</a>
247+
- <a class='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.
250252

251-
* <a class='knowledge-check-link' href='#relations-and-lazy-evaluation'>How does lazy evaluation help make Active Record more efficient?</a>
252-
* <a class='knowledge-check-link' href='#checking-for-existence'>How do you check whether a database already contains a record?</a>
253-
* <a class='knowledge-check-link' href='#more-assorted-querying-knowledge'>What is the difference between a `#where` query and a `#find` query?</a>
254-
* <a class='knowledge-check-link' href='#joins'>How do you join tables together in Rails?</a>
255-
* <a class='knowledge-check-link' href='#n1-queries-and-eager-loading'>What is an example of an N+1 query?</a>
256-
* <a class='knowledge-check-link' href='#n1-queries-and-eager-loading'>What method is used to deal with an N+1 query?</a>
257-
* <a class='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/)
255+
- [RailsCasts #22 Eager Loading](http://railscasts.com/episodes/22-eager-loading-revised)
256+
- [Introduction to the N+1 Problem](https://www.youtube.com/watch?v=Xr3hZdIwuSw)
257+
- [N+1 Problem: Eager Loading with Active Record](https://www.youtube.com/watch?v=wLMRzdOztUY)
258+
- [N+1 Problem: Optimized Counts with Joins and Custom Select](https://www.youtube.com/watch?v=rJg3I-leoo4)
259+
- [Speed up ActiveRecord with a little tweaking](https://blog.codeship.com/speed-up-activerecord/)
260+
- [A useful gem that identifies N+1 queries](https://github.com/flyerhzm/bullet)

0 commit comments

Comments
 (0)