开发者

Twitter in ruby on rails helper

I want to include my tweets on my homepage. Currently I have a helper which looks like this:

module WelcomesHelper

 def recent_tweets(user)
   html = "<div>"
   Twitter.user_timeline(user).each do |tweet|
       html << '<span class="tweet">' << tweet.text << '</span>'
   end 
   html << "</div>"
 end

end

However, it can not find the twitter gem. If it require it from irb it works fine, but how do I include it开发者_运维技巧 in my rails app?


Assuming rails3 - add

gem 'Twitter'

to your Gemfile, run bundle and it should work in your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜