lib/formtastic/custom_attributes.rb in custom-attributes-0.2.1 vs lib/formtastic/custom_attributes.rb in custom-attributes-0.2.2
- old
+ new
@@ -121,10 +121,14 @@
)
end
def field_name_for(attribute_type, field_type)
- "#{@object.class.model_name.underscore}[custom_attributes][#{attribute_type}][#{field_type}][]"
+ if @object.custom_attributes.supported_attribute_types.keys.include? attribute_type
+ "#{@object.class.model_name.underscore}[custom_attributes][#{attribute_type}][#{field_type}][]"
+ else
+ "#{@object.class.model_name.underscore}[#{attribute_type}][#{field_type}][]"
+ end
end
def custom_field_input(attribute_type, field_method_priority, label, value, options = {})
label_name = field_name_for attribute_type, "label"
label_field = template.text_field_tag(label_name, label, :list => "#{attribute_type}-label-suggestions", :autocomplete => "off")
\ No newline at end of file