module SmartEnum::ActiveRecordCompatibility::ClassMethods

Constants

ID

Public Instance Methods

base_class() click to toggle source

Used in AR polymorphic associations. Returns the base of this class' SmartEnum STI tree.

# File lib/smart_enum/active_record_compatibility.rb, line 28
def base_class
  unless self < ::SmartEnum
    raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from SmartEnum"
  end

  if superclass == ::SmartEnum
    self
  else
    superclass.base_class
  end
end
primary_key() click to toggle source
# File lib/smart_enum/active_record_compatibility.rb, line 19
def primary_key
  ID
end
reset_column_information() click to toggle source
# File lib/smart_enum/active_record_compatibility.rb, line 23
def reset_column_information
  # no-op for legacy migration compatability
end