Created
January 6, 2012 20:17
-
-
Save jzellman/1572222 to your computer and use it in GitHub Desktop.
How to do this Idiom in Rails 3
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
#!/usr/bin/env ruby | |
# works in rails 3 | |
RAILS_ENV = ARGV[0] | |
if RAILS_ENV.nil? | |
puts "usage: blah.rb environment" | |
exit | |
end | |
ENV['RAILS_ENV'] = RAILS_ENV | |
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'application')) | |
puts Rails.env | |
# Do something smart here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment