Module: SmartEnum::ActiveRecordCompatibility::ClassMethods

Defined in:
lib/smart_enum/active_record_compatibility.rb

Constant Summary collapse

ID =
"id"

Instance Method Summary collapse

Instance Method Details

#base_classObject

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



28
29
30
31
32
33
34
35
36
37
38
# 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_keyObject



19
20
21
# File 'lib/smart_enum/active_record_compatibility.rb', line 19

def primary_key
  ID
end

#reset_column_informationObject



23
24
25
# File 'lib/smart_enum/active_record_compatibility.rb', line 23

def reset_column_information
  # no-op for legacy migration compatability
end