views:

948

answers:

4

What does that mean?

In the instructions for a project, it said to "freeze the Rails gems". Is that different from freezing the Rails version?

What's freezing about?

+18  A: 

If one of the authors of a gem you use introduce a new version of the gem, there is a possibility the new version introduces backwards incompatible changes that would break your code.

Freezing a gem puts it into the vendor folder of your application, and it will not be automatically updated on its own. Rails will use this version of the gem instead.

This allows you to update the gem on your system for other apps, while having your sole app use the version of the gem that you have always been working with, and therefore is stable.

This applies to the rails gem itself as well, as newer versions of rails might eventually cause something in your app to break, freezing it will prevent the system wide update (and, once again, allows you to update other apps on your machine, while leaving the app you freeze rails in at that version number.

phillc
Nice explanation. Thanks.
Bijou
+1  A: 

Here's a tutorial that goes into freezing a rails app.

Ólafur Waage
+3  A: 
sean lynch
+2  A: 

Freezing is great - as others have said it reduces your dependency on your external environment. It's particularly important if you're on shared hosting, or otherwise don't fully control where you deploy.

However, it can be problematic for programs like rake and capistrano that don't run within your Rails environment. They have their own gem loading path, which you can affect, but you need to be aware of it. Also, a gem with native extensions (libxml, hpricot, ...) can't be frozen, because the OS-specific bits still need to live in the external OS.

Also, probably not an issue right now but something to be aware of - Rails 3 will be moving to a new method of managing plugins, gems, and the vendor directory in general. It's all kind of a mess at the moment.

Sarah Mei