aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2013-09-24 15:00:23 +0900
committerRhenium <rhenium@rhe.jp>2013-09-24 15:00:23 +0900
commitc4e6ed7c271c7109c0f26a1c3adf6584ef8f5012 (patch)
tree12165f5392efe25e60753fca06026858b925d0ef
parent67490df4564b7fd174190d41408e56b2a81f216e (diff)
downloadaclog-c4e6ed7c271c7109c0f26a1c3adf6584ef8f5012.tar.gz
fix 500 error of user page: when the user hasn't been favorited/retweeted
-rw-r--r--app/models/user.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index e072f94..d7a1928 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -58,6 +58,8 @@ class User < ActiveRecord::Base
Rails.cache.fetch("stats/#{self.id}", expires_in: 3.hours) do
favorited_counts, retweeted_counts = self.tweets.pluck(:favorites_count, :retweets_count).transpose
+ favorited_counts ||= []
+ retweeted_counts ||= []
ret = OpenStruct.new
ret.updated_at = Time.now