Fetching Cotacts from Gmail, Yahoo and Hotmail

Hello Guys,

This is another post by me, hope this post will help you, if you are stuck in fetching or grab contacts from Yahoo, Gmail and Hotmail. This is possible using gem ‘contacts’.

So here I am posting my code, I know there are lot of things and code available for this, but this is the exact code which I am using.

If you are running an application or want to create a new go ahead, I am writing a new application here but you can add it in your existing code as well.

open your command or console prompt and go into your application directory, here I am creating new:

rails contact

this will create a particular set of files and directories in your application. Now go into your directory, before start working any further be sure that you have installed ‘contacts’ gem with the latest version i.e 1.0.13, to install ‘contacts’ type :

for linux users : sudo gem install contacts

for windows : gem install contacts

if already have but older version update it : sudo gem update contacts

Now open your environemnt.rb file and below this line write

Rails::Initializer.run do |config|


require ‘contacts’

be sure to restart your server.

Now open the controllers folder and create this method in any controller if you have or where you want to display this. In my case I am writing this in my account_controller.rb

def invite_friends
#@user = User.find(params[:id])

def import
@users = User.find(params[:id])
@sites = {“gmail”  => Contacts::Gmail, “yahoo” => Contacts::Yahoo, “hotmail” => Contacts::Hotmail}
@contacts = @sites[params[:from]].new(params[:login], params[:password]).contacts
@users , @no_users = [], []
@contacts.each do |contact|
#if u = User.find(:first , :conditions => @users.email = ‘#{contact[1]}’ , :include =>[:user])
if u = User.find(:first , :conditions => “email = ‘#{contact[1]}'” )
@users << u
@no_users << {:name => contact[0] , :email => contact[1]}
respond_to do |format|
format.html {render :template => ‘shared/_contact_list’, :layout => false}
format.xml {render :xml => @contacts.to_xml}

before creating this two method, just be sure that you are giving the user id from invite_friends method to import method.

Open up your invite_friends.html.erb and paste this code :

<% form_tag :action => ‘import’, :id => @user do %>

<select name=”from” id=”from”>
<option value=””>Select Id</option>
<option value=”gmail”>Gmail</option>
<option value=”yahoo”>Yahoo</option>
<option value=”hotmail”>Hotmail</option>

<BR />
<p>Please Enter Your Email Address Below : <BR />
<input type=”text” name=”login”></p>
<p>Enter Your Password :<BR />
<input type=”password” name=”password”></p>

<p><h4>Note : we are not going to save your Password anywhere </h4></p>
<p><%= submit_tag ‘Find My Friends’ %>

<% end %>

Now start your server, open up firefox and type the address (in my case it is) : http://localhost:3000/account/invite_friends

Select any service like Yahoo, Hotmail or Gmail give the corresponding username and Password and hit submit.

You will get an error message that missing template, to remove that create a folder ‘shared’ in /app/views/ and create a new file name ‘_contact_list.html.erb’ and paste the below code :

<% for i in @contacts %>
<input type=”checkbox” name=”email[]” id=”email_<%= i %>” value=”<%= i %>” /><%= i %><br>
<% end %>

this will help you to take further actions on fetched email addresses, that’s it. You have done..

If you are facing any problems, leave a comment, I will get back in touch with you, and if your code works, don’t forget to leave a comment.

Thanks to ‘contacts’ and thanks to you all also.


86 thoughts on “Fetching Cotacts from Gmail, Yahoo and Hotmail

  1. Tony January 23, 2009 / 5:00 PM

    How are you getting the Yahoo importer to work on your localhost? It seems that you have to register your website to be trusted, and they don’t let you register localhost.



  2. Puneet Pandey January 27, 2009 / 7:28 AM

    hey tony I have not registered anywhere… all you need is to install the latest version of contacts in your machine.. the older version of it are giving problems with Yahoo

  3. Ganesh February 12, 2009 / 3:17 AM

    Sorry.. I mentioned ROR 2.6 instead of ROR 2.1 in above comment..
    Actually, simultaneously I’ working on Python 2.6 Django.

  4. Ganesh February 12, 2009 / 9:37 AM

    Hi punnet,

    Thanks for the questions. I working & learning ROR 2.1 from last 7 month. Getting gr8 reference for me. You really did a good work.
    I need your help..! Can I fetch contacts other than the Gmail, Yahoo, Hotmail by Contacts gem?

    Can u mail me mail-Id…?

    Ganesh K.

  5. Puneet Pandey February 12, 2009 / 9:46 AM

    Hi Ganesh,

    if you have some doubts ask me here itself, I will answer those..

    for your convenience I have left a comment on this in Ruby on Rails Interview Questions.

    feel free to ask me any doubts if you have.

    Regards 🙂

    • Syed Tabrez June 5, 2012 / 3:11 PM

      Hey Puneet Thank you very much,it was really helpful.You are awesome…

  6. Ganesh February 18, 2009 / 10:14 AM

    Thanks puneet,

    Actually I’m working on Social networking project. So, that I’m trying to provide/fetch contacts function from any domain of the user, where he have an account.
    like rediff, zapakmail, etc..

    So, is it possible..?

    – Ganesh K.

  7. Nirbhab February 24, 2009 / 12:33 PM

    It works fine, but hotmail says that we need to update the protocol.

    Can please suggest what need to be done?


  8. congrio February 25, 2009 / 10:06 AM

    I have problems with Hotmail. Does it works for you fetching hotmail contacts?

    For me, gmail and yahoo works great.

  9. Puneet Pandey February 25, 2009 / 11:04 AM

    Hi congiro and Nirbhab

    I checked this gem with gmail and yahoo, I haven’t checked it with Hotmail as I don’t have an account with it… gimme some time to create that, I will let you know guys soon, where the script goes wrong, by the do send me the error logs if both of u can.


  10. Puneet Pandey February 26, 2009 / 9:29 AM

    Hi Nirbhab,

    Thanks for pointing out that Hotmail has changed its protocol, Even I tried this also today but it was not working for me, I am trying to get in touch with lucas, the guy who has created this contacts gem, may be he has some solution of this..

    I will get back with some output soon.


  11. nirbhab March 2, 2009 / 12:21 PM

    Any update you found?

  12. Puneet Pandey March 2, 2009 / 3:20 PM

    Hi Nirbhab,

    I dropped a mail to lucas the soul of this contacts gem.. but I haven’t got any reply from his side.. apart from that I am also checking Rubyforge daily about any updates on this Gem… Hope he will drop me a mail soon, meanwhile if you find out any clew don’t forget to knock me..


  13. suresh ramasamy March 25, 2009 / 5:04 AM

    i couldnt able to install “gem install contacts” in my system. Iam getting ‘gem_original_require’ error. I searched in the net, they told to install “gem install json_pure” but still iam getting the same error.
    Do you have any solutions, let me know.

    Also i need to get contact from outlook also.
    Do you know how to do this , let me know.

    Thanks in Advance,
    Suresh Ramasamy.

  14. suresh ramasamy March 25, 2009 / 5:52 AM

    Hi i solved my first issue from your blog “https://puneetitengineer.wordpress.com/2008/12/23/problem-in-installing-contacts-gem-in-windows/”

    Thanks a lot !!!

    Now I need to get contact from outlook also.
    Do you have any idea on this ?

  15. Puneet Pandey March 25, 2009 / 8:55 AM

    Hi suresh,

    feels great that my post gave you +ve results.. well, about contact from outlook I think this gem will not solve your problem…

    I seriously don’t have any ideas on it, but will try to search around and let you know..

    Just in case if you find any solution don’t forget to leave a comment on my blog..


  16. suresh ramasamy March 25, 2009 / 10:00 AM

    when i tried to execute your code it giving “uninitialized constant AccountController::Contacts”
    If you know any idea on this

  17. umamageshwari April 13, 2009 / 6:41 AM

    /1.8/rubygems.rb:636:in `report_activate_error’: Could not find RubyGem json (>= 0.4.1) (Gem::LoadError)

    this is the error i am getting while restarting the server after adding contacts in environment.rb

    rails 2.2.2

  18. Puneet Pandey April 13, 2009 / 7:00 AM

    Hi Umang,

    If you are working on windows there is a mswin-32 gem available, download that and then install it.

    If you are working on linux, you directly need to type: sudo gem install json in terminal.

    Feel free to ask me any doubts if you have.

    Puneet Pandey

  19. suresh ramasamy April 14, 2009 / 7:17 AM

    Now I can able to get his email id’s from gmail… Is it is possible to get all the contact informations say his first name, last name, company details etc from gmail (if the value exists). If yes, how ?

  20. Rafeek June 4, 2009 / 1:20 PM

    Hi Puneet,

    Thanks for your great guidence and code posted here. I completed very sucessfulextracting Google Contact Details with your contact.

    Thanks for again

    Rafeek 🙂

  21. Usha P June 14, 2009 / 9:56 PM

    Hi Puneet,

    Thanks for putting together this gem…I got my app working with your gem and it seems to retrieve contacts for gmail & yahoo.

    However, with yahoo, I’m noticing some blocking inconsistencies..

    1. For one of email accounts in yahoo, it seems to give me a list of contacts (62) while when I log into yahoo, the number of contacts is much greater…(322)

    2. For one of the email accounts in yahoo, it gives me 0 contacts, while this account in yahoo has a lot of contacts (422)

    I’m really stumped by this inconsistency. I really need to get this to work for both gmail and yahoo….Can you let me know whats happening here? On my server log, there is no suspicious output (same log as the one for successful yahoo account contact retrieval)

    I’m hoping you can respond quickly as I’m blocked at the moment….I need my app to be rock solid and consistent…

  22. Usha P June 14, 2009 / 10:00 PM

    Btw, for gmail, all results are consistent for all 3-4 gmail accounts I tested this with…only yahoo retrieval results are inconsistent….

  23. Puneet Pandey June 15, 2009 / 4:17 AM

    Hi Usha,

    Thanks a ton that my script works for you… but your problem seems strange to me.. coz if you are using contacts-1.0.13 it should work fine for yahoo and gmail.. We all tried this..and this is working… if you can wait give me a hour or so, I can give you the solution (if this problem exists)..

    Meanwhile if you are in a hurry.. you can use plaxo.

    Let me know what do you say?


  24. Charlie June 15, 2009 / 9:09 AM

    Hi Puneet,

    I’ve found this a great post. I have done it flawlessly. What I am wondering as of the moment is that. How am I going to send an invitation mail to list of my friends in Yahoo, Google & Hotmail.
    Help me with the code..

  25. Puneet Pandey June 15, 2009 / 10:37 AM

    Hey Charlie,

    I got the problem that you are facing, I have the code of it.. will mail it to u asap.


    • Charlie June 15, 2009 / 11:21 AM

      Hey Puneet,

      You are really really good hope to get the code soon. Hope you also create a tutorial about blackbook gem. Cos all of the tutorials in other blogs and sites sucks.

  26. Usha P June 15, 2009 / 4:48 PM


    My app needs to integrate with both gmail and yahoo, so yahoo is critical. I have the latest gem and I had no problems installing or getting it to work. But for sure the results in yahoo are not right…

    Can you clarify if the gem is using ClientLogin API from gmail/yahoo or scraping technology (like a contact grabber kind of script..)?


  27. Usha P June 16, 2009 / 12:34 AM

    Hi Puneet,

    Any updates? Thanks much in advance,


  28. Puneet Pandey June 16, 2009 / 4:31 AM

    Hi usha,

    Sorry for posting my reply late, I am wondering how it is still not working for you.

    Can I ask you which version of rails you are using?

    As per you doubt is concerned, I would like to tell you that its kind of client login API, if you look at the configuration files, you will find that it has predefined set of variables like:
    URL = “http://mail.yahoo.com/”
    LOGIN_URL = “https://login.yahoo.com/config/login”
    etc etc.

    so you can see it will not pick you to the direct yahoo, gmail websites.

    I think yahoo uses CSV, so please check if you have fastercsv installed in your system.

    Let me know if this helps.


  29. Puneet Pandey June 16, 2009 / 4:37 AM

    if that fastercsv doesn’t work for you, let me know we will test it further.. is hotmail working for you? if you are using contacts-1.0.13

  30. Puneet Pandey June 16, 2009 / 5:30 AM


    This code will send mail to the list of users you have shortlisted.. I am assuming here that you know how to send mail in rails.

    First of all create a form_for syntax like this:
    { :controller => ‘contacts’, :action => ‘add_contact’ } do %>

    <input name="email[]" type="checkbox" id="email_” value=”” />

    Then in your contacts controller write this code:
    def add_contact
    params[:email].each do |email_list|
    @contact = Contact.new(params[:contact])
    @contact.user_id = current_user.id
    @contact.email_id = email_list
    if @contact.save!
    UserMailer::deliver_request_confirmation(@contact, @contact.email_id)
    flash[:error]=”There is some problem in sending mail”
    flash[:notice] = “Contacts has been saved”

    Work to that accordingly, I am sure this will gonna help you 🙂


  31. Puneet Pandey June 16, 2009 / 5:32 AM


    Some text are missing so work according to that

    • Charlie June 16, 2009 / 5:42 AM

      Hey Puneet,

      I haven’t tried it. But anyways thanks for the code. You’re such a savior for us.


  32. Charlie June 16, 2009 / 6:24 AM

    For the last time Puneet,

    Do you know how to display the avatar of the shortlisted contacts?

    Thanks again,

  33. Puneet Pandey June 16, 2009 / 6:35 AM


    I haven’t used it, but I have some clue of it, you need to install the plugin for that, by running this command:

    ruby script/plugin install svn://rubyforge.org//var/svn/gravatarplugin/plugins/gravatar

    once the plugin installed, write something like this in front of each user where your email address are:

    or it might be
    or it might be

    depending upon the variable name you are using.

    Try this, Unfortunately I have not used it in my app. You have to create it by your own 🙂


  34. Charlie June 16, 2009 / 7:34 AM

    could you please send a compressed app of this. I am experiencing some bitchy difficulties.

  35. Puneet Pandey June 16, 2009 / 8:40 AM


    I helped you as much as I can.. now you have all the necessary information and code with you.. dubegging now is on your hand 🙂


  36. Charlie June 16, 2009 / 8:57 AM


    Thanks. 🙂



  37. Charlie June 16, 2009 / 9:06 AM

    Mr. Puneet,

    I got these errors:

    NoMethodError in EmailController#add_contact

    You have a nil object when you didn’t expect it!
    You might have expected an instance of Array.
    The error occurred while evaluating nil.each



  38. Puneet Pandey June 16, 2009 / 9:36 AM


    I think you are a rails beginner.The problem occurs coz you are working on arrays.. make sure you are getting the right results while passing values to the controller.

  39. Charlie June 16, 2009 / 9:54 AM

    Hey Puneet,


    Thank you very much,

    Charlie 🙂

  40. Charlie June 16, 2009 / 9:55 AM

    Hey Puneet,


    Thank you very much,

    Charlie 🙂

  41. Usha June 16, 2009 / 8:54 PM

    Puneet – I’m going to test this tonight (see if I have fastercsv and if it makes a difference to the consistency of results from yahoo) and then post my results here as soon as I can…

  42. Puneet Pandey June 17, 2009 / 4:06 AM


    Anytime 🙂


    I looked at this gem configuration, It requires csv, which is a pre-build library of ruby. so you don’t need to go for installing fastercsv gem. I am also creating an app, will let you know once it works..

    but yaa surely I will wait for you reply and do let me know what rails version you are using and which OS you are using?


  43. Usha P June 17, 2009 / 5:56 PM


    I seem to have the faster csv already (1.4.0). Here are is my env version information. Again, some yahoo contacts are showing up for some accounts (while 0 contacts for other yahoo accounts although there are close to 437 contacts in that account)…I’ll look forward to your reply. Here is the info you asked…

    OS: Windows XP (Dell laptop)

    Rails version:
    Rails 2.0.2

    Ruby version:
    ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

    RubyGems Environment:
    – RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
    – INSTALLATION DIRECTORY: c:/ruby1/lib/ruby/gems/1.8
    – RUBY EXECUTABLE: c:/ruby1/bin/ruby.exe
    – EXECUTABLE DIRECTORY: c:/ruby1/bin
    – ruby
    – x86-mswin32-60
    – GEM PATHS:
    – c:/ruby1/lib/ruby/gems/1.8
    – C:/Documents and Settings/usha.SUNDEEP-67A019F/.gem/ruby/1.8
    – :update_sources => true
    – :verbose => true
    – :benchmark => false
    – :backtrace => false
    – :bulk_threshold => 1000

  44. Puneet Pandey June 18, 2009 / 9:38 AM


    Please open your yahoo mail from yahoo.com and go into your contact list and see how many contacts you have there, if there are 10 contacts this method will display you only 10 friends who are on that list.

    To debug add a new friend there by giving his/her email and all the essential details and then check this code again, this time I am sure it will show you 11 records(as per my example)

    So the bottom line is this gem never looks how many friends you have, you must have their details saved in the contacts(i.e yahoo’s contacts)

    Puneet Pandey

  45. Usha P June 18, 2009 / 6:16 PM


    I have some more insights for you (did some debugging). Wh (when I create new contacts in yahoo for these users, whether after sending emails and confirming to add to my addressbook, OR going to the addressbook directly and adding them there), they DO show up correctly in my app.

    Where I think the issue is retrieval of all existing contacts…Again, new contacts adding in yahoo showing up perfectly…old contacts (only some are showing up while all of them have contact info in the addressbook).

    Ultimately, if yahoo computes the users to show up in the addressbook, I believe the gem should be picking them too. Is there a problem on the yahoo side you think?

    — Usha

  46. Desperate Rails Newbie June 22, 2009 / 5:01 AM

    Hi Sir,

    I am rails newbie. I’ve followed all of the steps that you include here but it seems the code you gave to the one (Charlie) doesn’t work instead it display errors.

    Please help me,

    Desperate Rails Newbie

  47. Puneet Pandey June 22, 2009 / 8:44 AM

    I don’t know where are you stuck in your application… let me know your problem exactly so that we would discuss it


  48. Desperate Rails Newbie June 22, 2009 / 8:56 AM


    You had said to the guy that there are some texts missing on the codes that you had gave to him. I am stuck on sending email.


    Desperate Rails Newbie

  49. Desperate Rails Newbie June 22, 2009 / 9:03 AM

    Oh I do have the code about sending an email. The other detail of the missing texts is what I really want.

    Desperate Rails Newbie

  50. Puneet Pandey June 22, 2009 / 9:17 AM

    I am using form _ for syntax in my rhtml page, so follow the steps:
    – put form_for
    – end for_for
    – write @contacts[1] after your check box syntax

    Hope it helps 🙂

  51. Rafeek June 29, 2009 / 12:50 PM

    Hi Puneet,
    Thanks 🙂 sharing the code. I am able to fetch the contact from gmail and i have list of emails with the name – email of the contact person. These 2 fields are coming from the @contacts then how can i fetch value inside the @users and @nousers in the _contact.html.erb.

    I want only the email from my contacts. If its possible can tell be how can i fetch email only from the gmail contacts.

    Rafeek 🙂

  52. Wayne June 29, 2009 / 10:52 PM

    Hi Puneet,

    I’m having a bit of problems importing Hotmail contacts into my rails app. Error I get by calling Contacts::Hotmail.new(‘login’,’password’).contacts is:

    NoMethodError: You have a nil object when you didn’t expect it!
    You might have expected an instance of ActiveRecord::Base.
    The error occurred while evaluating nil.[]
    /Library/Ruby/Gems/1.8/gems/contacts-1.0.13/lib/contacts/hotmail.rb:112:in `contacts’

    Can you take a look at that?


  53. Puneet Pandey June 30, 2009 / 4:23 AM


    You have @contacts variable inside that your name and email id’s are available. If you use @contacts[1], you will get the list of names and if you use @contacts[0] you will get the list of all email ids. Please check it once try to do the opposite of it, coz ur solution might be @contacts[1]


    You are getting this error because Hotmail has changed its protocol and unfortunately contacts-1.0.13 doesn’t support the updated protocol of Hotmail. May be you can ask to lucas directly, I am not sure if the contacts-1.0.14 is up and running.. but I want you to make sure of it.

    Puneet Pandey

  54. Puneet Pandey June 30, 2009 / 4:26 AM


    I hope you have got the answer of your problem… I apologise for replying late, I have gone through your post and found this problem something strange. If still I can help you out with something else, don’t feel hesitate to ask me.

    Puneet Pandey

  55. Desperate Rails Newbie June 30, 2009 / 7:46 AM

    Hi Sir,
    Sorry for late replying the code that you gave me gives me this error:

    You have a nil object when you didn’t expect it!
    You might have expected an instance of Array.
    The error occurred while evaluating nil.each

    app/controllers/contacts_controller.rb:5:in `add_contact’

  56. Desperate Rails Newbie June 30, 2009 / 7:47 AM

    This was the code that I made add_contact.html.erb

    “add_contact”, :controller => “contacts” do %>

    <input type="checkbox" name="email_list[]" id="email_” value=”” />

    “submit” %>

  57. Glasto July 3, 2009 / 9:03 AM

    Hi Sir,

    I am a first year college student but I don’t follow. Can u please repost it cos I really need the code so bad especially the sending of the email.

    Please sir help me your code works in fetching the contacts but when sending the email it gives me hell errors.

    Please please..


  58. Puneet Pandey July 3, 2009 / 9:12 AM

    @Desperate Rails Newbie

    You must specify some action also with controller. But Let me know What you have written in your controller’s method.


    There are several ways of sending mails. You must be having some SMTP settings with you, so that you can send mails. let me know if that settings you have with you.


  59. noisybrain October 25, 2009 / 7:28 AM

    I have tried all the stuff on mailboxes recently, even fetching messages and compose mails too, using ruby’s internal ruby/imap library. It works perfectly with gmail and yahoo, havent checked with others.

    Apart from fetching the contacts, you can add a contact, perform all operations on them mailbox. Contacts gem uses the same library to access the mail box, I just used it because i needed more than only address book, i needed unread messages etc, so I manipulated stuff using this


    Hope that is useful


  60. Anuraj Pandey October 30, 2009 / 4:46 PM


    i m getting connection timed out error while fetching contacts from yahoo..however importing with gmail is working fine..

    plz help..

    • Puneet Pandey October 31, 2009 / 5:57 AM

      You need to update your gem:
      give this command sudo gem update contacts
      It should install the latest version of your gem which is 1.0.18

      Hope it helps

      • supriya June 1, 2011 / 6:43 AM

        Hi Puneet,

        Can we import other contact details like first name, last name, profile picture etc. using this gem??

      • Puneet Pandey June 16, 2011 / 8:18 PM

        Hi Supriya,

        I am sure there must be some way to fetch the first name, last name. I would recommend you to read the API docs for it. As, I implemented this feature a long back.
        If I come across with anything, will share the details with everyone.

        – Puneet

  61. Raj September 14, 2011 / 4:30 AM

    Hi Puneet,

    I user contacts gem in my ROR application, but the result contacts come along with name and email like test usertestuser@yahoo.com. Is there any way to fetch email only from the contacts?

    If you give a solution it will really help for me.


    • Puneet Pandey February 4, 2012 / 6:44 PM

      There is a way to get email addresses only. But, I am not sure what that is.. Probably, you need to google this, or give me sometime, I will post you update on the same.

  62. lavanya September 23, 2011 / 7:30 AM

    hi punnet

    I am getting some error like uninitialized constant Contacts:: Gmail while i am impoting contacts from gmail

    • Puneet Pandey February 4, 2012 / 6:42 PM

      @lavanya: Its been a long time, I haven’t used this gem. But, are you using it on Rails-3? Or maybe, gmail has changed something in their API.

      But would help you better, if you provide me logs for that.

  63. lavanya September 23, 2011 / 11:32 AM

    hi punnet,

    Does it works in rails 3,when i am adding require ‘contacts’ in environment.rb it is showing some error when server starts

    • Puneet Pandey February 4, 2012 / 6:40 PM

      For rails-3, you need to define all the gem dependencies in Gemfile, nothing will come in environment.rb file

      Let me know, if you’ll face any issues.

  64. shogothl February 15, 2012 / 7:27 PM

    ==> Hotmail has changed its protocols, please upgrade this library first.

    Since some days,
    Do we need to update the gem ???

    • Puneet Pandey August 23, 2012 / 9:42 AM

      Hi Paul,

      Could you please let me know, if you’re still facing this issue? If so, I will take a look into it and let you know!

      – Puneet

    • Paul Goulart August 23, 2012 / 2:50 PM

      Hi Puneet, thanks for your concern. I moved on to something else. If I end up needing to use your gem again I’ll let you know if I run into the same problem. Have a nice day!

  65. Prajakta Waghmare April 30, 2012 / 7:09 AM

    hi Puneet,
    thanx for such a nice guidline….
    im getting an error uninitialized constant AccountController::Contacts…
    plz tell me solution

    • Puneet Pandey August 23, 2012 / 9:41 AM

      Hi Prajakta,

      Just saw your comment. Was away since last few months. What’s the status now? Are you still facing this Error?

      – Puneet

  66. suresh June 4, 2012 / 2:40 PM

    hi puneet,
    i am using contacts gem in my ror application i am trying to fetch gmail contacts but its showing undefined method contacts in my controller..

    can you help me why its showing undefined method ‘contacts’ ?

    • Puneet Pandey August 23, 2012 / 9:40 AM

      Hi Suresh,

      I will have to check it out.. What’s the status now? Are you able to resolve it? Coz I was not available since last couple of months and got a chance now to see and reply to your comment.

  67. amit June 5, 2012 / 3:13 PM

    great its superv

  68. Ganeshkumar May 20, 2014 / 5:33 AM

    Hi Puneet,

    I have tried this article in my local machine.I got error.

    My Rails version : 4.0.4

    1. rails new contacts

    2. Install the contacts gem

    > gem install contacts

    3. Add this code to gemfile

    gem ‘contacts’, ‘~> 1.2.4′

    4. bundle install

    5. Start server

    > rails s

    I got following error :

    /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/gdata-1.1.1/lib/gdata.rb:21:in `require’: cannot load such file — jcode (LoadError)
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/gdata-1.1.1/lib/gdata.rb:21:in `’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `require’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/contacts-1.2.4/lib/contacts/gmail.rb:1:in `’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/contacts-1.2.4/lib/contacts.rb:6:in `require’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429/gems/contacts-1.2.4/lib/contacts.rb:6:in `’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require’
    from /Users/ganesh/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require’

    I made any mistake?

    Please advice.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Connecting to %s