Skip to content

Instantly share code, notes, and snippets.

@sprite2005
Created April 14, 2009 00:25
Show Gist options
  • Save sprite2005/94846 to your computer and use it in GitHub Desktop.
Save sprite2005/94846 to your computer and use it in GitHub Desktop.
require 'activerecord'
module LoadRails
def load_rails
environment_file = File.expand_path(CONFIG["rails_root"] + "/config/environment.rb")
raise "There is no config/environment.rb file!" unless File.exists?(environment_file)
ENV['RAILS_ENV'] = CONFIG["rails_environment"] || 'development'
require environment_file
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment