method
say_with_time
v7.1.3.2 -
Show latest stable
-
2 notes -
Class: ActiveRecord::Migration
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (38)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
say_with_time(message)
public
Outputs text along with how long it took to run its block. If the block returns an integer it assumes it is the number of rows affected.
Register or
log in
to add new notes.
joshuapinter -
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 ) end # Output -- Reverting all service rates to nil. -> 0.3451s -> 2233 rows
rab -
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 ... counter end #=> "-- Some complex, custom work" #=> " -> 45.3725s" #=> " -> 52880 rows"