intridea/tweetstream — Issue #64: A wiki post on how to use TweetStream in Rails Environment?
Author: Rhodee
Created: 2012-02-28 15:29:21+00:00
State: open

Hi and thanks for this gem.

After reviewing your screencast I was interested in adding this functionality to a rails app. I bundled the gem, placed a file called `tweetstream.rb` in the initializers directory and set up the configuration block exactly as provided in the docs.

Here is the error message I received in the console upon firing up the server:

/home/../config/initializers/tweetstream.rb:1:in `': undefined method `configure' for TweetStream:Module (NoMethodError)

I would like to add the tweets to a sidebar, so I decided to use the `content_for` like so, nested in a partial.

<% content_for :tweets do %>
<% @tweets = TweetStream::Client.new %>
<% @tweets.track('nyc', 'jobs') %>
<% @tweets.each do |tweet|%>

<%= tweet %>

<% end %>
<% end %>

<%= yield :tweets %>

What is the proper way to load the configure block in a Rails application?