Search code examples
ruby-on-railsrubygemsrackdreamhost

Bypassing rack version error using Rails 2.3.5


I'm currently on Dreamhost attempting to run a Rails 2.3.5 app.

Here is the situation, Dreamhost's servers have Rails 2.2.2 installed. Of course, I can't update a shared host's rails version, so I froze my Rails in vendor. Rails 2.3.5 requires the rack v1.0.1 gem. Dreamhost uses the rack v1.0.0 gem. So when I try to define:

config.gem "rack", :version => "1.0.1"

I get:

can't activate rack (~> 1.0.1, runtime) for [], already activated rack-1.0.0 for []

So what I really need to do is bypass my app's request to use 1.0.1, and use Dreamhost's 1.0.0. Does anyone know how to configure this? Is it even possible? Thanks for the help.


Solution

  • You will almost always want to unpack the gems that your application depends on into the vendor folder. You can do that with this rake command:

    rake gems:unpack:dependencies
    

    This will create a folder vendor/gems under your application's root folder and unpack all of the gems that you declared with the config.gem command into it.

    This will not only solve your problem with mismatching rack versions, but also make sure that you are using the exact same versions of gems in production as you are using in development, which can prevent many potential headaches in the future.