Ruby on Rails latest stable (v4.2.1) - 2 notes - Class: ActiveRecord::Migration
say_with_time(message) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
January 30, 2012
2 thanks

Requires a Block.

Just a little heads up here because it’s not obvious.

This requires a block to be passed to it.

Example Usage

say_with_time "Reverting all service rates to nil." do
  Service.update_all( :rate, nil )

# Output
-- Reverting all service rates to nil.
   -> 0.3451s
   -> 2233 rows
November 17, 2014 - (>= v3.1.0)
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 ...

#=> "-- Some complex, custom work"
#=> "   -> 45.3725s"
#=> "   -> 52880 rows"