18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/locomotive/formtastic.rb', line 18
def input_class_with_const_defined(as)
input_class_name = custom_input_class_name(as)
module_class_name = input_class_name.deconstantize
module_class = module_class_name.blank? ? ::Object : module_class_name.constantize
input_class_name_wo_module = input_class_name.demodulize
if module_class.const_defined?(input_class_name_wo_module)
input_class_name.constantize
elsif Formtastic::Inputs.const_defined?(input_class_name)
standard_input_class_name(as).constantize
else
raise Formtastic::UnknownInputError, "Unable to find input class #{input_class_name}"
end
end
|