module AxleAttributes class ParentDefinition < ::AxleAttributes::Definition setup do setup_storage! setup_index! setup_versioning! end private def setup_storage! if type storage_options = case type when :text {type: :string} else options.slice(:type, :default) end model.attribute(name, storage_options) end end def setup_index! if mapping = index_mapping model.elastic_index.mapping[:properties].merge!(name => mapping) end end def setup_versioning! if versioned? model.add_versioned_attribute name end end end end