Module: SimpleForm::MapType

Included in:
FormBuilder, Inputs::MappingInput
Defined in:
lib/simple_form/map_type.rb

Instance Method Summary collapse

Instance Method Details

#map_type(*types) ⇒ Object

Raises:



7
8
9
10
11
# File 'lib/simple_form/map_type.rb', line 7

def map_type(*types)
  options = types.extract_options!
  raise ArgumentError, "You need to give :to as option to map_type" unless options[:to]
  types.each { |t| mappings[t] = options[:to] }
end

#mappingsObject



3
4
5
# File 'lib/simple_form/map_type.rb', line 3

def mappings
  @mappings ||= {}
end