Skip to content

Commit c47c289

Browse files
authored
Merge pull request rails#33147 from nsgc/add-api-document-about-migration-methods
Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_messages [ci skip]
2 parents cad0b7d + 3c63f1e commit c47c289

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

activerecord/lib/active_record/migration.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,14 @@ def announce(message)
831831
write "== %s %s" % [text, "=" * length]
832832
end
833833

834+
# Takes a message argument and outputs it as is.
835+
# A second boolean argument can be passed to specify whether to indent or not.
834836
def say(message, subitem = false)
835837
write "#{subitem ? " ->" : "--"} #{message}"
836838
end
837839

840+
# Outputs text along with how long it took to run its block.
841+
# If the block returns an integer it assumes it is the number of rows affected.
838842
def say_with_time(message)
839843
say(message)
840844
result = nil
@@ -844,6 +848,7 @@ def say_with_time(message)
844848
result
845849
end
846850

851+
# Takes a block as an argument and suppresses any output generated by the block.
847852
def suppress_messages
848853
save, self.verbose = verbose, false
849854
yield

0 commit comments

Comments
 (0)