Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def dynamic_attribute_inputs(form, model)
inputs = model.dynamic_attributes.map do |attr|
options = {
label: attr.display_name,
as: datatype_mapping(attr.datatype)
}
form.input attr.name, options
end
safe_join inputs
end
def datatype_mapping(type)
case type
when ActiveDynamic::DataType::Text then :text
when ActiveDynamic::DataType::Integer then :integer
else :string
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.