instance method inverse

Ruby on Rails 3.1.12

Since v3.1.12 Last seen in v3.2.22.5

Available in: v3.1.12 v3.2.22.5

Signature

inverse()

Returns a list that represents commands that are the inverse of the commands stored in commands. For example:

recorder.record(:rename_table, [:old, :new])
recorder.inverse # => [:rename_table, [:new, :old]]

This method will raise an IrreversibleMigration exception if it cannot invert the commands.

Source
# File activerecord/lib/active_record/migration/command_recorder.rb, line 39
      def inverse
        @commands.reverse.map { |name, args|
          method = :"invert_#{name}"
          raise IrreversibleMigration unless respond_to?(method, true)
          send(method, args)
        }
      end

Defined in activerecord/lib/active_record/migration/command_recorder.rb line 39 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Migration::CommandRecorder

Type at least 2 characters to search.

↑↓ navigate · open · esc close