instance method
revert
Ruby on Rails 6.1.7.10
Since v4.0.13Signature
revert()
While executing the given block, the recorded will be in reverting mode. All commands recorded will end up being recorded reverted and in reverse order. For example:
recorder.revert{ recorder.record(:rename_table, [:old, :new]) } # same effect as recorder.record(:rename_table, [:new, :old])
Source
# File activerecord/lib/active_record/migration/command_recorder.rb, line 64
def revert
@reverting = !@reverting
previous = @commands
@commands = []
yield
ensure
@commands = previous.concat(@commands.reverse)
@reverting = !@reverting
end
Defined in activerecord/lib/active_record/migration/command_recorder.rb line 64
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Migration::CommandRecorder