Created
January 8, 2015 14:40
-
-
Save woods/4d4af26fb91f51d73c72 to your computer and use it in GitHub Desktop.
An example of a helper for determining which instance/flavor we're running.
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
# A helper for determining which partner site we're on. This can be | |
# used for setting a CSS class on the body tag in the layout, or | |
# for referencing namespaced assets or translations. | |
def parner(host=request.host) | |
if $ENV['PARTNER'] == 'graduate' || host =~ /graduate/i | |
'graduate' | |
elsif $ENV['PARTNER'] == 'schreyer' || host =~ /schreyer/i | |
'schreyer' | |
else | |
# decide whether to fail or default to one of the above | |
end | |
end |
Although it is a little less slick than just being able to symlink and open http://schreyer.dev/ ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And it doesn't stop a developer from having two browser windows open with a different partner running in each one. You just have to fire up separate servers for each environment variable (on different port numbers).