Reputation: 4728
What I want - users of the rails app can post at their twitter account through the app
What I have done so far - I am using Devise and Twitter gems, and have filled all the twitter details at /initializers/twitter.rb file
Twitter.configure do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.oauth_token = ""
config.oauth_token_secret = ""
end
now I can create a controller "post_twitter" with index action and a view but I am not sure, how to do the integration with this controller/view and twitter ?
Thanks
Upvotes: 4
Views: 1334
Reputation: 16619
In your controller you could use the Twitter
class, this is what I have done
def create
@post = Post.new(params[:post])
Twitter.update("I'm tweeting with @gem!")
#code
end
Make sure you enable POST privileges to your Twitter app, and if the Twitter update fails it should give you an error message.
Upvotes: 3