Freezing rails to an older version using gems

Problem
You want to deploy to a shared host (dreamhost) that has a later version of rails from the one you have developed your application.
You also have a later version installed in your development pc,and using rake rails:freeze:gems uses the latest one and not the one you want.

Solution
Use the following to freeze the specific version you want, and by using your gems you have installed:
rake rails:freeze:gems VERSION=2.3.2

Freezing gems (other than rails) on 2.3.4

Problem
Your host (ie dreamhost) for deploying applications doesn’t have the gems you are using in your development.

Solution
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:

rake gems:unpack