Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
posts = Post.all
Parallel.each(posts, :in_processes => 10) do |post|
# Reconnect to prevent errors with Postgres
ActiveRecord::Base.connection.reconnect!
post.title = post.title.downcase
post.save!
end
# Goes with
# http://ruby.zigzo.com/2012/01/29/the-parallel-gem-and-postgresql-oh-and-rails/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment