简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM