Friday, October 28, 2011

Gem.source_index is deprecated, use Specification ( ERROR in Rails)

Hi,


Today, while setting up my new system with Rails, I was getting the following error when starting mongrel/webrick dev server:




NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.


My configuration for rails was:


Ruby version 1.9.2
Rails version 2.3.8
gems version 1.8.11


OS version: Windows XP.


I solved the problem very easily. If you notice in the configuration section, my gem version is 1.8.11. This is causing the issue. So, I downgraded my gem version to 1.6.2 and the problem was SOLVED !!.


The following is the command for downgrading the gem version:


gem update --system 1.6.2


Hope that this small instruction will help someone !!