, ,

1. Download Ruby for windows at Ruby Installer
2. After Ruby was installed successfully in your hard drive, you will install DevKit. The DevKit is a toolkit that makes it easy to build and use native C/C++ extensions such as RDiscount and RedCloth for Ruby on Windows. More details about DevKit at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
When executing bundle install or rails new {projectname} you might got an error that says e.g. Gem::InstallError: The ‘json’ native gem requires installed build tools.In that case, you need to install DevKit.

NOTE: for the legacy RubyInstaller v1.8.6 use the DevKit-3.4.5 available at our archive downloads page. For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit 4.5.2 from our main downloads page.

C:\>cd devkit-1.8.7-1.9.3
C:\devkit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.2 at C:/Ruby192
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193

# Initialization complete! Please review and modify the auto-generated
# 'config.yml' file to ensure it contains the root directories to all
# of the installed Rubies you want enhanced by the DevKit.

C:\devkit-1.8.7-1.9.3>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby192'
[INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'
[INFO] Skipping existing gem override for 'C:/Ruby193'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby193'

Confirm your Ruby environment is correctly using the DevKit by running gem install rdiscount. RDiscount should install correctly and you should see with native extensions in the screen messages. Next run

c:\Ruby(versionNumber)>ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html" to confirm that the rdiscount gem is working.

3. After DevKit was installed, go to your Ruby folder e.g. c:\Ruby193>. In your command prompt type this:

c:\Ruby(versionNumber)\bin>gem install --no-rdoc --no-ri rails

If you want to install for a specific version use -v option e.g., gem install rails -v ‘3.12.11’
As you noticed, we install first the rdoc instead of the rails. The reason is that you might encountered an error that says “File not found: lib”.
Although some of the gems are successfully installed.

Some other ways in installing Ruby on Rails on Windows:
You can use Rails Installer. RailsInstaller has everything you need to hit the ground running. In one easy-to-use installer, you get all the common packages needed for a full Rails stack. It includes Ruby, Rails, Git, SQLite, etc.

If you want to install multiple ruby versions in your environment, you can use rvm for linux and uru for windows.

Click here on how to install uru on windows.
How to install pik on windows
Or using rbenv if youre on Ubuntu

Thats it. Happy RoR!!