almost 11 years ago
When we have to create a hash in just one line we can use this particular ruby code:
@users = User.find :all user_hash = Hash[@users.map {|x| [x.id, x.name]}]
Here we created a hash in just one line with Id as the key of hash and name of the user as value of the hash.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)