Here's a simple example that does this using the HTTParty gem:
In your controller to post the tweet:
twitter = Twitter.new(username, password)
twitter.post(message)
And here is the Twitter class:
require 'httparty'
class Twitter
include HTTParty
base_uri 'twitter.com'
def initialize(u=nil, p=nil)
@auth = {:username => u, :password => p} unless u.nil? || p.nil?
end
def post(text)
self.class.basic_auth @auth[:username], @auth[:password]
self.class.post('/statuses/update.json', :query => {:status =>
text})
end
end
On May 11, 2009, at 5:55 AM, cool wrote:
>
> Guys,
>
> I need a help very badly in this issue.
> I have a text fields it takes username and password for twitter.
> when i create an announcement and click save directly it should
> appear on the twitter status updates for that username and password.
>
> Please help me in this issue. Iam struck with this issue.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---