Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
def get_field_type_for(kind)
types = {
"nr" => "number",
"tlf" => "number",
"telefon" => "number",
"nummer" => "number",
"merknad" => "text",
"notater" => "text",
"anmerkning" => "text"
types[kind.to_s.downcase] || "string"

rolfb commented Feb 20, 2012

mini-performance boost by not using types.default (hat tip @Hakon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment