views:

862

answers:

2

When creating a new Rails project using:

rails sample

Then creating a model using:

script/generate model person first_name:string last_name:string

Everything is fine. However, if I add any gems to my environment.rb:

config.gem "authlogic"

And run the same generator, I get the following:

/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.

The warning just recently appeared (I think), but I would like to fix it if possible. Any hints or similar experiences?

Thanks.

+1  A: 

did you try:

rake gems:install

Btw. If you are using rubygems 1.3.6 then you get this deprecation warning. Previous versions never gave a warning. Also i suggest installing any gem using the command line rather than adding it in the environment.rb file. If the gem(s) you have added in the file is/are not installed, then the generator or any rake task will simply not run. Its a minor bug.

Here is an article that describes a way to prevent the warning: http://www.mattvsworld.com/blog/2010/03/version_requirements-deprecated-warning-in-rails/

Its no big deal though. Just install gems the normal way and don't add any to your environment.rb file. You'll never get the deprecation warning.

Shripad K
Thanks! I followed a few links and got to this commit: http://github.com/rails/rails/commit/268c9040d5c3c7ed30f3923eee71a78eeece8a8a
Kevin Sylvestre
A: 

After trying rake gems:install i still get error

(in /var/www/html/redmine) rake aborted! Access denied for user 'root'@'localhost' (using password: NO)

(See full trace by running task with --trace) [root@vi65 redmine]# rake gems:install (in /var/www/html/redmine) rake aborted! Access denied for user 'root'@'localhost' (using password: NO)

(See full trace by running task with --trace)

Using ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux] Rails 2.3.5 gem --version 1.3.7

Ankit Shah