Class: SimpleForm::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/simple_form_extension/ext/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#_original_find_mappingObject



5
# File 'lib/simple_form_extension/ext/form_builder.rb', line 5

alias_method :_original_find_mapping, :find_mapping

#find_mapping(input_type) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simple_form_extension/ext/form_builder.rb', line 7

def find_mapping(input_type)
  camelized = if (klass = self.class.mappings[input_type])
    name = klass.name
    (name =~ /^SimpleForm::Inputs/) ? name.split("::").last : name
  else
    "#{ input_type.to_s.camelize }Input"
  end

  mapping = attempt_mapping(camelized, SimpleFormExtension::Inputs)
  return (discovery_cache[input_type] = mapping) if mapping
  _original_find_mapping(input_type)
end