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)
|
|
|
|
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
|