February 19, 2010 15:08
Posted by Jeremy Durham
Rails 2.3.5 + bundler 0.9.x
This is the best way I’ve seen so far to get Rails 2.3.5 working with Bundler 0.9.x:
Create config/preinitializer.rb with the following code:
begin # Require the preresolved locked set of gems.require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError => e
raise RuntimeError, "Please run `bundle lock` and try again."
# Fallback on doing the resolve at runtime. require "rubygems" require "bundler" Bundler.setupendUpdate config/boot.rb and add the following before Rails.boot!
class Rails::Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
enddef extend_environment
Rails::Initializer.class_eval do
old_load = instance_method(:load_environment)define_method(:load_environment) do
Bundler.require :default, Rails.env
old_load.bind(self).call end end endendNow, just run bundle install and bundle lock and you’re good to go.









0 Comments
Leave a comment