require_gem is obsolete

It's pretty explicit: 'gem' should be used instead of 'require_gem'. Have you tried examining the mentioned file at the given line number?

Open config/boot.rb, go to line 29, and change 'require_gem' to 'gem'. There's another one 10 lines later, too.

It is of course only a warning, not an error, as it specifies. I still find it visually annoying enough to merit changing.

HTH,

J.

Is the “rails” command for generating apps actually producing the code with require_gem? Has it not been patched so that RubyGems < 0.9.1 will still work? Other wise…

Steve Longdo wrote:

Is the "rails" command for generating apps actually producing the code with require_gem? Has it not been patched so that RubyGems < 0.9.1 will still work? Other wise...

I just ran rake rails:update (per my other post, and thaaanks for teeelling me about it, guys!), and it fixed my gem() calls by upgrading them to require_gem().

Steve Longdo wrote: > Is the "rails" command for generating apps actually producing the code with > require_gem? Has it not been patched so that RubyGems < 0.9.1 will still > work? Other wise...

$ script/about ./script/../config/boot.rb:29:Warning: require_gem is obsolete. Use gem instead. About your application's environment Ruby version 1.8.5 (powerpc-darwin8.8.0) RubyGems version 0.9.1 Rails version 1.2.1 ...

The above is from a MacPorts-installed rails. Locomotive has the same issue:

$ script/about ./script/../config/boot.rb:29:Warning: require_gem is obsolete. Use gem instead. About your application's environment Ruby version 1.8.5 (powerpc-darwin7.9.0) RubyGems version 0.9.1 Rails version 1.2.1 ...

Jordan Krushen wrote:

> I just ran rake rails:update (per my other post, and thaaanks for > teeelling me about it, guys!), and it fixed my gem() calls by > upgrading them to require_gem().

Shouldn't that be the other way 'round?

That was my insinuation. I fixed things manually, like y'all are discussing, then I ran rails:update, and it un-fixed them.

phlip@penbird:~/projects$ rails -v Rails 1.2.1 phlip@penbird:~/projects$ rails scratch phlip@penbird:~/projects$ cd scratch/ phlip@penbird:~/projects/scratch$ grep require_gem config/boot.rb         require_gem "rails", "=#{rails_gem.version.version}"       require_gem "rails"

The base generator is generating the noisily deprecated version.

Phlip wrote:

phlip@penbird:~/projects$ rails -v Rails 1.2.1 phlip@penbird:~/projects$ rails scratch phlip@penbird:~/projects$ cd scratch/ phlip@penbird:~/projects/scratch$ grep require_gem config/boot.rb        require_gem "rails", "=#{rails_gem.version.version}"      require_gem "rails"

The base generator is generating the noisily deprecated version.

Oooh, lookie here:

phlip@penbird:~/projects/scratch$ public/dispatch.rb ./public/../config/boot.rb:29:Warning: require_gem is obsolete. Use gem instead. Status: 400 Bad Request /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:405:in `to_constant_name': Anonymous modules ha ve no name to be referenced by (ArgumentError)         from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:215:in `qualified_name_for'         from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:477:in `const_missing'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:117:in `reset_after_dispatch'         from /usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:51:in `dispatch'         from public/dispatch.rb:10

A brand-new Rails program has the bug that I'm stuck on, as mentioned in my other post.

I found a trac ticket that shows the remaining files in Rails that still use require gem. http://dev.rubyonrails.org/ticket/6886

These two in particular are what are causing the commotion on 1.2.1:

railties/environments/boot.rb
railties/lib/rails_generator.rb