Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Total contributions and pledged are called more than once in the same…
… request, we don't need to hit the database every time
  • Loading branch information
diogob committed Mar 25, 2015
1 parent 4447b27 commit 793d470
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/project.rb
Expand Up @@ -158,11 +158,11 @@ def expires_at
end

def pledged
project_total.try(:pledged).to_f
@pledged ||= project_total.try(:pledged).to_f
end

def total_contributions
project_total.try(:total_contributions).to_i
@total_contributions ||= project_total.try(:total_contributions).to_i
end

def total_payment_service_fee
Expand Down

0 comments on commit 793d470

Please sign in to comment.