Module: EnumKit::ActiveRecordExtensions::Migration::CommandRecorder

Defined in:
lib/enum_kit/active_record_extensions/migration/command_recorder.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#create_enum(*args) ⇒ Object

:nodoc:



17
18
19
# File 'lib/enum_kit/active_record_extensions/migration/command_recorder.rb', line 17

def create_enum(*args)
  record(:create_enum, args)
end

#drop_enum(*args) ⇒ Object

:nodoc:



23
24
25
# File 'lib/enum_kit/active_record_extensions/migration/command_recorder.rb', line 23

def drop_enum(*args)
  record(:drop_enum, args)
end

#invert_create_enum(args) ⇒ Object

:nodoc:



29
30
31
# File 'lib/enum_kit/active_record_extensions/migration/command_recorder.rb', line 29

def invert_create_enum(args)
  record(:drop_enum, args.first)
end

#invert_drop_enum(args) ⇒ Object

:nodoc:



35
36
37
38
39
40
41
# File 'lib/enum_kit/active_record_extensions/migration/command_recorder.rb', line 35

def invert_drop_enum(args)
  unless args.length > 1
    raise ::ActiveRecord::IrreversibleMigration, 'drop_enum is only reversible if given an Array of values.'
  end

  record(:create_enum, args)
end