开发者

twitter gem not working in heroku?

开发者 https://www.devze.com 2023-02-01 11:48 出处:网络
I\'m working on a ruby app that updates a twitter account using \'twitter\' gem. It\'s working fine locally (as usual :) ). But when I deploy it on heroku it seems the gem is not properly installed or

I'm working on a ruby app that updates a twitter account using 'twitter' gem. It's working fine locally (as usual :) ). But when I deploy it on heroku it seems the gem is not properly installed or something lile that as I got the following error:

NameError: uninitialized constant Twitter::OAuth

My code is very simple:

oauth = Twitter::OAuth.new(consumer_token, consumer_secret)
oauth.authorize_from_access(access_token, access_secret)
client = Twitter::Base.new(oauth)开发者_如何学编程
client.update("Updating my status from twitter gem.  GREAT!")

Is there a problem with this particular gem ?

Thanks a lot for your help. Luc


Have you created a .gems file and put twitter in it?

Depending on which heroku 'stack' you are on, you may need to do that instead of a bundler Gemfile. You can change your stack for one that uses bundler by doing this:

heroku stack:migrate bamboo-ree-1.8.7

Which makes bundler available (I think).


That is a common message that usually implies that you have a discrepancy between your local gems and the gems in heroku. If you are not using Bundler yet, you should. You will end un writing a very simple Gemfile that will tell Heroku (or any other entity using your code) which gems and versions you require.

http://gembundler.com/


I would suggest that you should use the heroku addon called 'apigee', ut makes twitter on heroku simple:

http://addons.heroku.com/apigee


I just got a sinatra app talking to Twitter through Heroku/Apigee, my rate limit went from 300 calls per hour to 20,000 calls per hour. Here's a step by step on what to do:

http://geeks.aretotally.in/mind/2011/1/8/increasing-api-limits-on-a-sinatra-twitter-app-with-twitter_.html

I am really a Java developer just playing around with Sinatra but let me know if I can help in anything.

Felipe

0

精彩评论

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