Send Tweets from rails application

Hey all,

I hope this article will help you if you want to send tweets from your rails application. I have used couple of gems and plugins for that, will describe you those in this tutorial.

AIM: We have a rails application which will allow twitter user to log-in. Once the user logged-in he/she can send tweets from your rails application.

DEPENDENCIES: 1. geokit-rails [Plugin]
2. ym4r-gm [Plugin]
3. twitter4r [Gem]
4. twitter-search [Gem]
5. twitter-console [Gem]
6. google-geocode [Gem] [Optional]

1. Install twitter4r (gem install twitter4r[for windows user], sudo gem install twitter4r[for linux users])
2. Install twitter-search (sudo gem install dancroak-twitter-search -s
3. Install twitter-console *for linux users only
[Follow this:
[and this:
4. Install google-geocode (sudo gem install google-geocode)
5. Install goekit-rails
5.1 ruby script/plugin install git://
5.2 Add this line to your environment.rb: config.gem “geokit”
5.3 Tell Rails to install the gem: rake gems:install
(for more details visit this link:
6. Install ym4r_gm (ruby script/plugin install svn://
[if you get trouble in installation follow this:

So we have a base setup for our rails application. Now lets have some code.
First of all lets create few models as well as migrations tables:
1. ruby script/generate model Keyword
2. ruby script/generate model Location
3. ruby script/generate model Post
4. ruby script/generate model User
5. ruby script/generate model Techtwit
6. ruby script/generate migration sessions

After creating all the above steps lets create some columns for our tables:
1. for keywords: timestamps
2. for locations: address:text, timestamps
3. for posts: message: text, timestamps
4. for users: username:string, password:string
5. for techtwits: twitter_id:string, timestamps
6. for sessions: session_id:string, data:text, timestamps
6.1 add_index :sessions, :session_id
6.2 add_index :sessions, :updated_at

Follow this Tutorial to finish-off this application.


6 thoughts on “Send Tweets from rails application

  1. Hi
    Rest of the tutorial is not available in the link mentioned. Can you please provide me with the rest of the tutorial. It would be a great help. Thanks

  2. Alpesh

    Hi Puneet,

    This is such a very helpful article.

    But I don’t get your tutorial.When I click on that link it displays nothing.

    Can you please provide me that tutorial?

    Thanks in advance.

    1. Hi Alpesh,

      This is not a complete article, I will publish it soon and let you.. as others are waiting as well…. Meanwhile, if you have time just keep on visiting this entry, as you’ll get some updates..


  3. amalraj

    Hi Puneet,

    I just want the source code for the tweets that you have described above (i.e send tweets from rails application .) i am waiting for your reply


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s