Created
March 28, 2009 22:02
-
-
Save henrypoydar/87216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the user record for which you'd like to import | |
tom = User.first | |
everyone_view = [{'user_group_id' => tom.account.user_groups.everyone.id}].map {|group| [group['user_group_id'], 'default']} | |
# create the import, pointing to the csv | |
UserActionLogger.log_actions_with(tom) { $i = Import.create(:views => everyone_view, :user => tom, :source => File.open("/Users/danferranti/Desktop/Tuckerbrook-test.csv"), :state => 'preparing') } | |
# check that the headers map properly | |
$i.map_header | |
# set any global tag names if you'd like for the import | |
# $i.tag_names = [] | |
# run the import (3-4 contacts per second on local machine fwiw) | |
Import.import_execute($i) | |
# check the failed row numbers of CSV | |
$i.failed_row_identifiers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment