Rails Rake Tasks, displays a message during and at the end

I did the railes rake task which loads / crop / sizes (using paperclip) silly amounts of images.

I wanted to know how to output a message to the terminal when it was launched (for example, the chipolata.jpg handler), and in the end it takes several minutes to start, and a little feedback will be good.

Thanks.

+5
source share
2 answers

Just use the standard Ruby command puts:

puts "Hello from Rake!"

You can use string interpolation to output individual file names in a loop:

puts "#{image_filename} processed"
+13
source

In your loop, it simply calls:

puts "chipolata.jpg processed"
0
source

All Articles