Created
February 1, 2010 23:08
-
-
Save eladmeidar/292148 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
# The original post by Yehuda says that code should go under config/preinitializer.rb, which can work if you are not running under Passenger | |
# that doesn't really gives a shit yet about preinitializer.rb, so you need to put this code at the bottom of your config/boot.rb not that the # Rails.boot! line should already be in your boot.rb file, it's just here for a position reference. | |
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment" | |
class Rails::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_environment) | |
define_method(:load_environment) do | |
Bundler.require_env RAILS_ENV | |
old_load.bind(self).call | |
end | |
end | |
end | |
end | |
# All that for this: | |
Rails.boot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment