This tip comes by way of: @starvo.

By using a counter in your ruby console script you can gain insight into long running actions for your application.

@photos = Photo.all
count = @photos.count
@photos.each_with_index do |photo, idx|
  # ... do a bunch of processing
  puts "#{(100.0 * idx / count).round(2)}%"
end

# When the script is run we will get a percentage complete counter like:
#=> 0.1%
#=> 0.2%
#=> 0.3%
#=> 0.4%
#=> ...

🙂

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.