heartcombo--simple_form/lib/simple_form/map_type.rb

13 lines
309 B
Ruby

module SimpleForm
module MapType
def mappings
@mappings ||= {}
end
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
end
end