Tagged with tip

Ruby Tip: Normalizing Hash Keys as Symbols

Written by Ben

Ruby hash keys can be any type of object apart from an integer, but typically they are used in two ways when coding a rails app.
With string keys:
{”a” => “hash”}
Or symbol keys:
{:a => “hash”}
When writing a method that uses a hash of arguments you should handle both styles of hashes. There are a number of [...]