From c4e6ed7c271c7109c0f26a1c3adf6584ef8f5012 Mon Sep 17 00:00:00 2001 From: Rhenium Date: Tue, 24 Sep 2013 15:00:23 +0900 Subject: fix 500 error of user page: when the user hasn't been favorited/retweeted --- app/models/user.rb | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit v1.2.3