Skip to content

Commit

Permalink
Eager fetch gist files
Browse files Browse the repository at this point in the history
  • Loading branch information
rwdaigle committed Oct 3, 2012
1 parent 95f567c commit 56014a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/gists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/gists/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 56014a9

Please sign in to comment.