# Freeze gems

**URL:** <https://www.ruby-forum.com/t/freeze-gems/159257>\
**Category:** Rails\
**Created:** [February 2, 2009, 8:12pm UTC](https://www.ruby-forum.com/t/freeze-gems/159257 "2009-02-02T20:12:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh\_richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/91b2a8/32.png) [@josh\_richard](https://www.ruby-forum.com/u/josh_richard)\
**Post date:** [February 2, 2009, 8:12pm UTC](https://www.ruby-forum.com/t/freeze-gems/159257/1 "2009-02-02T20:12:19Z")

</div>

Hello everyone. Anyone run into this problem?

I have an rails app which is running rails 2.2.2 with rubygems 1.2.0  
on a dev box. Rails is frozen and in SVN. The hosting server is  
running gems 0.9 which appears to be incompatible with rails 2.x. Is  
there a way to freeze rubygems (aka, gem) into a rails project so I do  
not impact other’s applications?

What I have done (using 1.3.1 as a test case):

wget [http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz](http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz)  
tar zxvf rubygems-1.3.1.tgz  
mv rubygems-1.3.1/lib lib/rubygems  
cd   
svn add lib/rubygems  
svn ci -m ‘added libraries’  
rake deploy (to push app into production)

The idea was I would place the lib/rubygems directory ahead of  
everything in the load path…

edit config/environment.rb

# Add additional load paths for your own custom dirs

config.load\_paths.insert(0, %W( #{RAILS\_ROOT}/lib/rubygems/lib ).to\_s)

on the dev box this looks correct (./script/about):

About your application’s environment  
Ruby version 1.8.7 (i486-linux)  
RubyGems version 1.3.1  
Rails version 2.2.2  
Active Record version 2.2.2  
Action Pack version 2.2.2  
Active Resource version 2.2.2  
Action Mailer version 2.2.2  
Active Support version 2.2.2

On production it still is using the older version.:  
./script/about  
./script/…/config/…/vendor/rails/railties/lib/initializer.rb:214:in  
`install_gem_spec_stubs': undefined method `loaded\_specs’ for  
Gem:Module (NoMethodError)

It appears to still load 0.9.6 on the way.

Regards,

Josh Richard

---

<div class="post-metadata">

**Author:** ![josh\_richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/91b2a8/32.png) [@josh\_richard](https://www.ruby-forum.com/u/josh_richard)\
**Post date:** [February 2, 2009, 8:22pm UTC](https://www.ruby-forum.com/t/freeze-gems/159257/2 "2009-02-02T20:22:20Z")

</div>

On 2 Feb 2009, at 17:59, josh\_richard wrote:

> Hello everyone. Anyone run into this problem?
> 
> I have an rails app which is running rails 2.2.2 with rubygems 1.2.0  
> on a dev box. Rails is frozen and in SVN. The hosting server is  
> running gems 0.9 which appears to be incompatible with rails 2.x. Is  
> there a way to freeze rubygems (aka, gem) into a rails project so I do  
> not impact other’s applications?

You probably want to fiddle with $: right at the top of environment.rb

Fred

---

<div class="post-metadata">

**Author:** ![josh\_richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/91b2a8/32.png) [@josh\_richard](https://www.ruby-forum.com/u/josh_richard)\
**Post date:** [February 2, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/freeze-gems/159257/3 "2009-02-02T20:45:52Z")

</div>

> You probably want to fiddle with $: right at the top of environment.rb
> 
> Fred

Thanks Fred,

This did not work.

Josh

---

<div class="post-metadata">

**Author:** ![josh\_richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/91b2a8/32.png) [@josh\_richard](https://www.ruby-forum.com/u/josh_richard)\
**Post date:** [February 2, 2009, 11:24pm UTC](https://www.ruby-forum.com/t/freeze-gems/159257/4 "2009-02-02T23:24:37Z")

</div>

Fred,

I followed this link since it was close to what was needed. I added  
the ENV variables to the rails project with no success.

[http://www.rubygems.org/read/chapter/15#page101](http://www.rubygems.org/read/chapter/15#page101)

There are may examples on the net about how to freeze gems, but I am  
not finding any documentation about how to freeze rubygems itself.

This seems like a problem which should be common to site host ISPs.

thanks, all.

Josh
