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

13 lines
309 B
Ruby
Raw Normal View History

2009-12-09 17:48:40 +00:00
module SimpleForm
module MapType
def mappings
@mappings ||= {}
end
def map_type(*types)
options = types.extract_options!
2009-12-09 17:48:40 +00:00
raise ArgumentError, "You need to give :to as option to map_type" unless options[:to]
2010-01-09 14:39:14 +00:00
types.each { |t| mappings[t] = options[:to] }
2009-12-09 17:48:40 +00:00
end
end
end