Skip to content

Instantly share code, notes, and snippets.

@lnaia
Forked from zachwaugh/gist:521133
Last active August 29, 2015 14:21
Show Gist options
  • Save lnaia/d1399a626750b9a2eb39 to your computer and use it in GitHub Desktop.
Save lnaia/d1399a626750b9a2eb39 to your computer and use it in GitHub Desktop.
Loading rails environment in a script placed anywhere
#!/usr/bin/env ruby
ROOT_PATH = File.expand_path File.dirname(__FILE__)
APP_PATH = "#{ROOT_PATH}/PATH_TO_YOUR_APP"
Dir.chdir APP_PATH
require File.join(File.dirname(__FILE__), *%w[config environment])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment