Ruby on Rails Tuesday, June 7, 2016

Optimise in what sense? If this is about solving the N + 1 query problem then try:

blogs = Blog.include(:posts).limit(30)

This should load associated posts with only 1 query.
--
Greg Navis
I help tech companies to scale Heroku-hosted Rails apps.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAA6WWt9Ryn3K6bv1gDeQwEiA%3DkhiEuH7_SQEKcq%3D7TninfpsxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment