method
say_with_time
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
Register or
log in
to add new notes.
metavida -
September 16, 2008
rab -
November 17, 2014 - (<= v4.0.2)
![Default_avatar_30](https://www.gravatar.com/avatar/b526ab2828ebed7151e14174a8d242d4?default=http://apidock.com/images/default_avatar_30.png&size=30)
8 thanks
print standard-looking messages during migration
Within a migration file you can use the say_with_time method to print out informational messages that match the style of standard migration messages. See the say method also.
say_with_time "migrate existing data" do # ... execute migration sql ... end #=> "-- migrate existing data" #=> " -> 0.0299s"
![Default_avatar_30](https://www.gravatar.com/avatar/ef3aa7f7e577ea8cd620462724ddf73b?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
Include items affected in output
If the result returned from the block is an Integer, the output will include a message about that number of “rows” in addition to the elapsed time.
say_with_time "Some complex, custom work" do counter = 0 # ... do some stuff here that increments the counter ... counter end #=> "-- Some complex, custom work" #=> " -> 45.3725s" #=> " -> 52880 rows"