Skip to content

Instantly share code, notes, and snippets.

@chris
Created May 1, 2009 16:55
Show Gist options
  • Select an option

  • Save chris/105132 to your computer and use it in GitHub Desktop.

Select an option

Save chris/105132 to your computer and use it in GitHub Desktop.
Script to simply go through and save all active deals, so we update their Affiliate association
#!script/runner
# Script to simply go through and save all active deals, so we update their Affiliate association
page = 1
loop do
deals = Deal.active.paginate(:per_page => 100, :page => page)
deals.each do |deal|
Deal.without_revision {
begin
deal.save
rescue => e
puts "Failed to save deal id: #{deal.id}: #{e.message}"
end
}
end
page = deals.next_page
break unless page
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment