# config
PolymorphicIntegerType::Mapping.configuration do |config|
config.add :subject, {
1 => "Car"
}
end
class Car < ActiveRecord
include PolymorphicIntegerType::Extensions
has_many :extra_things,
as: :subject,
integer_type: true,
dependent: :destroy
end
class ExtraThing
include PolymorphicIntegerType::Extensions
belongs_to :subject, polymorphic: true, integer_type: true
end
Ex.
Setup:
Result:
subject_type
ona_fancy_new_thing
isnil
not1