As error message said, you need to install Ruby DevKit which can be obtained from RubyInstaller.org. (also need to check suitable Devkit version from there..)
And extract the DevKit zip file into somewhere (you are using windows then-> : c:\xxxx)
Navigate to c:\xxxx and run "ruby dk.rb init" and then "ruby dk.rb install"..
And try to re-insall rails..
I hope this helps,