When you try to install rails by thsi command : sudo gem install rail, then this error keep occurring: 

Building native extensions.  This could take a while…
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 -r ./siteconf20140817-14563-5arwq8.rb extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — mkmf (LoadError)
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’
    from extconf.rb:1:in `<main>’

extconf failed, exit code 1

Fixing this error by one simple command :

sudo apt-get install rubygems-integration

sudo apt-get install ruby1.9.1-dev