Created
November 24, 2009 21:30
-
-
Save agibralter/242240 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://yehudakatz.com/2009/11/03/using-the-new-gem-bundler-today/ | |
# Instead of hooking into load_environment which breaks gems that assume a | |
# certain load order (which is bad in its own right, but a reality), I hook | |
# into load_gems... This way, gems that assume load order but work with | |
# config.gem will still work with bundler. | |
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment" | |
module Rails | |
class Boot | |
def run | |
load_initializer | |
extend_environment | |
Rails::Initializer.run(:set_load_path) | |
end | |
def extend_environment | |
Rails::Initializer.class_eval do | |
old_load = instance_method(:load_gems) | |
define_method(:load_gems) do | |
old_load.bind(self).call | |
Bundler.require_env RAILS_ENV | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment