gem install fails so no installation of Rails

On Ubuntu 12.04 trying to install Rails with
$ gem install Rails
fails with
ERROR: Loading command: install (LoadError)
cannot load such file – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand

Ruby was installed with rbenv. More info:

~$ gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.23
  • RUBY VERSION: 1.9.3 (2012-10-12 patchlevel 286) [i686-linux]
  • INSTALLATION DIRECTORY: /home/user/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: /home/user/.rbenv/versions/1.9.3-p286/bin/ruby
  • EXECUTABLE DIRECTORY: /home/user/.rbenv/versions/1.9.3-p286/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-linux
  • GEM PATHS:
    • /home/user/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1
    • /home/user/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

and

~$ lsb_release -a;uname -a; dpkg -l|grep zlib
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Linux machine 3.2.0-32-generic-pae #51-Ubuntu SMP Wed Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux
ii zlib1g 1:1.2.3.4.dfsg-3ubuntu4 compression library - runtime
ii zlib1g-dev 1:1.2.3.4.dfsg-3ubuntu4 compression library - development

What is wrong?

No, the question is not silly at all. Actually, when I presented this problem in an Ubuntu forum I asked it myself.
And, yes, uninstalling and reinstalling ruby 1.9.3-p286 solved the problem.

Thank you very much!