2013-01-25 58 views
2

我正在使用全联接从gmail导入联系人。但它只需要99个联系人,而不是全部。 这里是我的代码为什么使用Omnicontacts导入gmail联系人只需要99个联系人

def contacts_callback 
    @contacts = request.env['omnicontacts.contacts'] 
    @contacts.each do |contact| 
    contact1 = current_user.contacts.new 
    contact1.name = contact[:name] 
    contact1.email = contact[:email] 
    contact1.group = "Others" 
    contact1.save(:validate => false) 
end 
    redirect_to "/contact" 
end 

我找不出问题。请帮忙。

回答

4

您需要在初始化程序中添加max_contacts选项:

importer :gmail, "xxx", "yyy", :max_results => 1000 

我刚更新了自述文件以包含这个。

0

解决它:)

我去LIB/omnicontacts /进口商/ gmail.rb

def initialize *args 
    super *args 
    @auth_host = "accounts.google.com" 
    @authorize_path = "/o/oauth2/auth" 
    @auth_token_path = "/o/oauth2/token" 
    @scope = "https://www.google.com/m8/feeds" 
    @contacts_host = "www.google.com" 
    @contacts_path = "/m8/feeds/contacts/default/full" 
    @max_results = (args[3] && args[3][:max_results]) || 100 
    end 

我只是改变@max_results 100〜500。现在,它的工作