views:

364

answers:

2

A sample application I was looking at has this in environment.rb:

  config.gem 'rails'

Is this redundant code or is there likely to be a reason the programmer did this?

+2  A: 

It's redundant code.

Jim Puls
+2  A: 

I guess you could use that if you had multiple versions of the Rails gem, and didn't freeze Rails into your application, so you could do something like

config.gem 'rails', :version => 2.2.2

But otherwise, it's redundant.

Daniel Vandersluis
Even that's redundant, thanks to the `RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION` a few lines earlier in the same file.
Jim Puls
Agreed. I just don't know why config.gem 'rails' would ever show up.
Daniel Vandersluis