4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/formtastic/custom_attributes.rb', line 4
def custom_attribute_inputs(include_associations = {})
@supported_attribute_types ||= {}
@supported_attribute_templates ||= []
has_custom = false
if @object.respond_to? :custom_attributes
@object.custom_attributes.defined_attribute_types.each do |attribute_type|
if attribute_type == :custom_attributes
has_custom = true
else
add_custom_attribute_template_for attribute_type
end
end
end
include_associations.each do |association, association_options|
add_custom_association_attribute_template_for association, association_options
end
add_custom_attribute_template_for :custom if @object.respond_to? :custom_attributes and has_custom
content_tag(:div, Formtastic::Util.html_safe(
@supported_attribute_templates.join +
add_custom_attribute_input
), :class => "custom-attributes")
end
|