Featured
-
Installing RVM and Creation of Gemsets Part 2
In the last tutorial we learnt how to install RVM.
by dinesh.singh -
Installing RVM and Creating of Gemsets Part 1
Installing RVM and creating Gemsets can be difficu
by dinesh.singh -
Use pik in Windows
Managing multiple versions of Ruby on Windows can
by anirudh.rautela -
Using Bundler in Rails 2.3.x app
Managing Gems in Rails can be infuriating at times
by anirudh.rautela
Tags
array and hashes in ruby
Ruby array is a list of elements that can be of any type either string or integer. Hence, In ruby it can be integer or string.
we can declare array by placing the elements inside the brackets like;-
arr = [1,"array",2,3,"h...
How to create Ruby hash in just one line ?
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 a...