You just can't convert variable to string or symbol. Try to structure you code with key and value in a hash, so you'll be able to retrieve the key as symbol.