2009-12-09 17:48:40 +00:00
|
|
|
module SimpleForm
|
|
|
|
module MapType
|
|
|
|
def mappings
|
|
|
|
@mappings ||= {}
|
|
|
|
end
|
|
|
|
|
2009-12-10 00:55:42 +00:00
|
|
|
def map_type(*types)
|
2010-09-27 02:21:30 +00:00
|
|
|
map_to = types.extract_options![:to]
|
|
|
|
raise ArgumentError, "You need to give :to as option to map_type" unless map_to
|
|
|
|
types.each { |t| mappings[t] = map_to }
|
2009-12-09 17:48:40 +00:00
|
|
|
end
|
|
|
|
end
|
2010-09-27 02:21:30 +00:00
|
|
|
end
|