Skip to content

Instantly share code, notes, and snippets.

@flyingoctopus
Created January 9, 2014 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyingoctopus/8343055 to your computer and use it in GitHub Desktop.
Save flyingoctopus/8343055 to your computer and use it in GitHub Desktop.
batch create
data_array = []
data = $redis.smembers(:sessions)
data.each do |d|
puts "adding to postgres: #{d}"
hash = eval d
object = hash.symbolize_keys!
puts 'saved!'
data_array.push object
$redis.srem(:sessions, d) # commented out for debugging purposes
end
puts "data array: #{data_array}"
Session.create(data_array)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment