How to Tweet from multiple acounts with twitter Gem in Rails?

Posted by Jmlevick on Stack Overflow See other posts from Stack Overflow or by Jmlevick
Published on 2012-10-15T21:13:44Z Indexed on 2012/10/15 21:37 UTC
Read the original article Hit count: 199

Filed under:
|
|

I have an application wich has Oauth access using Twitter as provider. I also have the ability to ask the logged user permisson to Read and Write in his/her account and once a user authorized the app, I can send tweets as the user with something like:

u = User.find(id)
u.twitter.update("Some-Status-Here")

in the rails console... What I want to do is to Tweet as all the users in one command, but if I try something like:

u = User.all
u.twitter.update("Some-Status-Here")

I get this error:

undefined method `twitter' for #<Array:0x00000002e2f188>

How can I tweet as all the users in one command? What am I doing wrong? I feel it is a very basic thing I'm missing... Can someone help me?

Thank You.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about twitter