J
John Blanco
I'm new to Ruby, but coming up to speed quickly. One question I still
have never seen a good explanation to is this: When is it preferred to a
key a hash with a symbol, and when is it keyed by string? Is this just
personal preference, or is there a rule of thumb?
For example, in the Rails book, the session variable is always populated
with symbols, i.e.:
session[:user] = User.new
It's also obviously completely common throughout the Rails framework
(e.g., :controller =>, :action =>, etc.)
So, when should I use what...or what should I prefer?
have never seen a good explanation to is this: When is it preferred to a
key a hash with a symbol, and when is it keyed by string? Is this just
personal preference, or is there a rule of thumb?
For example, in the Rails book, the session variable is always populated
with symbols, i.e.:
session[:user] = User.new
It's also obviously completely common throughout the Rails framework
(e.g., :controller =>, :action =>, etc.)
So, when should I use what...or what should I prefer?