Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SourceIndex#each is deprecated". How to rectify?

While running a Ruby on Rails program, I get a warning like this:

NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.

Gem::SourceIndex#each called from C:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:123.

NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.

Gem::SourceIndex#each called from C:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:124.

How to set this right and what does it mean here?

I work on a Windows environment with the following configuration:

  • Ruby 1.8.7 [i386-mingw32]
  • Rails 2.3.11
  • gem 1.8.8
like image 253
techtween Avatar asked Aug 22 '11 12:08

techtween


1 Answers

The deprecation warning is coming from Rails itself, as the backtrace notes. The intention of the warning is to warn you of imminent changes (2011-11-01) in Ruby's Gem class that may affect your Rails application.

As a solution for your Rails 2.3.x application, you could either:

  1. alter it to use Bundler; or
  2. upgrade it to a more recent version of Rails (e.g. 3.0.x).
like image 58
Sasha Avatar answered Oct 18 '22 23:10

Sasha