diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-06-18 19:24:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 19:24:23 +0900 |
commit | c47c289ac02cb60e8b01bb8b1892c040794b418f (patch) | |
tree | 80a81dd1361a72fc091cae2ab9048b4d62b8da1b /activerecord | |
parent | cad0b7d91dbc5abf4b0d7fdbcf2d0620557a3b0f (diff) | |
parent | 3c63f1e02159dfc728602ac9881d4b852759d514 (diff) | |
download | rails-c47c289ac02cb60e8b01bb8b1892c040794b418f.tar.gz rails-c47c289ac02cb60e8b01bb8b1892c040794b418f.tar.bz2 rails-c47c289ac02cb60e8b01bb8b1892c040794b418f.zip |
Merge pull request #33147 from nsgc/add-api-document-about-migration-methods
Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_messages [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 025201c20b..6ace973c29 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -831,10 +831,14 @@ module ActiveRecord write "== %s %s" % [text, "=" * length] end + # Takes a message argument and outputs it as is. + # A second boolean argument can be passed to specify whether to indent or not. def say(message, subitem = false) write "#{subitem ? " ->" : "--"} #{message}" end + # 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. def say_with_time(message) say(message) result = nil @@ -844,6 +848,7 @@ module ActiveRecord result end + # Takes a block as an argument and suppresses any output generated by the block. def suppress_messages save, self.verbose = verbose, false yield |