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.