Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Sikora
9,409 PointsTwitter gem and the Streaming Twitter API
I'm using the twitter gem to get tweets from a user's timeline and display them in my Ruby on Rails App. Using the REST API I can pull the tweets I want to but I want it to update live, so I need to use the Streaming API (I think). When I try to run the server with the configuration set to the Streaming API and using this code:
<% topics = ["UMD", "bitcamp"]%>
<%client.filter(:track => topics.join(",")) do |object|%>
<p><%= object.text if object.is_a?(Twitter::Tweet) %></p>
<% end %>
The server gets stuck "processing controller#index as HTML". This is just test code, because my ultimate goal is to grab the latest 20 tweets.
Sorry this is pretty basic stuff, I've just started to learn ruby on rails and the Twitter API and I'm struggling to find a useful resource for learning.
- Mike
2 Answers
Naomi Freeman
Treehouse Guest TeacherMy initial instinct is your controller needs to be saved as file type .rb instead of .html
I could be wrong though. Do you have this up on github so we can look at it? Thanks :)
Michael Sikora
9,409 PointsMichael Sikora
9,409 PointsThanks for getting back to me! Here's the specific file on git, there's not much going on in the rest of the app but please look around.
https://github.com/mikesikora/tweet_test/blob/master/app/views/welcome/index.html.erb