Created
August 5, 2009 17:17
-
-
Save cschneid/162840 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "rails", "app", "models") | |
| # Grab our own vendored copies of AR & AS. I had to hack AS to play nicely with <library> | |
| $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "vendor", "rails", "activesupport", "lib") | |
| $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "vendor", "rails", "activerecord", "lib") | |
| $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') | |
| require 'rubygems' | |
| require 'yaml' | |
| # Fix timezone support in Active Record | |
| require 'activerecord' | |
| Time.zone = "Pacific Time (US & Canada)" | |
| ActiveRecord::Base.time_zone_aware_attributes = true | |
| ActiveRecord::Base.default_timezone = "Pacific Time (US & Canada)" | |
| # Require all your models | |
| require 'users' | |
| #..... | |
| # Setup the ruby environment | |
| environment = ARGV[0] || "production" | |
| puts "Loading environment: #{environment}" | |
| db = YAML::load(File.open("../rails/config/database.yml").read)[environment] | |
| ActiveRecord::Base.establish_connection( | |
| db | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment