Skip to content

Instantly share code, notes, and snippets.

@rolfb
Forked from TorD/gist:1869279
Created February 20, 2012 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfb/1869574 to your computer and use it in GitHub Desktop.
Save rolfb/1869574 to your computer and use it in GitHub Desktop.
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"
end
@rolfb
Copy link
Author

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