Permalink
Browse files

Eager fetch gist files

  • Loading branch information...
1 parent 95f567c commit 56014a9325f69975b6ef1f0c829fc40b5b2e9880 @rwdaigle committed Oct 3, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 app/controllers/gists_controller.rb
  2. +1 −1 app/views/gists/index.html.haml
@@ -5,7 +5,7 @@ class GistsController < ApplicationController
before_filter :force_user_login
def index
- @gists = current_user.gists
+ @gists = current_user.gists.includes(:files)
end
def refresh
@@ -9,7 +9,7 @@
= "Created on #{gist.gh_created_at.to_datetime.to_formatted_s(:short)}, last updated on #{gist.gh_updated_at.to_datetime.to_formatted_s(:short)}"
%ul
%li
- = "#{pluralize(gist.files.count, "file")}:"
+ = "#{pluralize(gist.files.size, "file")}:"
%ul
- gist.files.each do |file|
%li

0 comments on commit 56014a9

Please sign in to comment.