Skip to content

Instantly share code, notes, and snippets.

@tommetge
Created December 28, 2011 17:33
Show Gist options
  • Select an option

  • Save tommetge/1528806 to your computer and use it in GitHub Desktop.

Select an option

Save tommetge/1528806 to your computer and use it in GitHub Desktop.
#!/usr/env/ruby
# read user ids in from CSV path
# path is the first argument in calling the script
sis_user_ids = File.readlines(ARGV[0]).map {|l| l.strip.split(",")}
sis_user_ids.each do |user_id, new_user_id|
ps = Pseudonym.find(:first, :conditions => "account_id = 81788 and sis_user_id = '#{user_id}'") rescue nil
if ps
ps.sis_user_id = new_user_id
ps.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment