diff app/controllers/tweets_controller.rb @ 48:8983c426e256

Prevent exploding on empty timeline.
author nanaya <me@myconan.net>
date Thu, 23 Apr 2015 16:14:35 +0900
parents 9e03bbbb1d43
children 8f68ca606099
line wrap: on
line diff
--- a/app/controllers/tweets_controller.rb	Thu Apr 23 16:05:08 2015 +0900
+++ b/app/controllers/tweets_controller.rb	Thu Apr 23 16:14:35 2015 +0900
@@ -3,9 +3,9 @@
   end
 
   def show
-    @tweets = Tweet.new(params[:id]).timeline
-
-    @user = @tweets.first.user
+    client = Tweet.new(params[:id])
+    @tweets = client.timeline
+    @user = client.user
   rescue Twitter::Error::NotFound
     head :not_found
   rescue Twitter::Error::Unauthorized