I couldn't get the hash value well, so I looked it up and found that it was a bit overlooked.
hash1 = {key: "value"} #=> {:key=> "value"}
When,
hash2 = {"key"=> "value"} #=> {"key"=> "value"}
Did not understand the difference. It seems that the key name changes depending on how you write it. In the above example
hash1["key"] #=> nil
hash1[:key] #=> "value"
become.
Recommended Posts