Skip to content

Instantly share code, notes, and snippets.

@jefferyf
Created June 20, 2012 20:21
Show Gist options
  • Save jefferyf/2961983 to your computer and use it in GitHub Desktop.
Save jefferyf/2961983 to your computer and use it in GitHub Desktop.
Monthly Consumption Details Conversion
ConsumptionDetail.find_in_batches(:batch_size => 500, :start => 208771) do |cd_batch|
cd_batch.each{ |cd|
cd.save(:validate => false); puts "ID: #{cd.id.to_s} ~ BUILDING NAME: #{cd.energy_source.property.name}"
}
end
@jefferyf
Copy link
Author

One Liner:

ConsumptionDetail.find_in_batches(:batch_size => 500, :start => 213477) do |cd_batch| cd_batch.each{ |cd| cd.save(:validate => false); puts "ID: #{cd.id.to_s} ~ BUILDING NAME: #{cd.energy_source.property.name}" } end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment