Created
July 8, 2009 03:33
-
-
Save mattyoho/142560 to your computer and use it in GitHub Desktop.
Access Rails routes from outside of controllers/views. Most rules have exceptions, folks.
This file contains 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
class CanHazRoutes | |
include ActionController::UrlWriter | |
host = case ENV['RAILS_ENV'] | |
when "production" | |
"prod.com" | |
when "staging" | |
"stage.com" | |
when "development" | |
"app.local" | |
end | |
default_url_options[:host] = host | |
def url_kthx(m) | |
polymorphic_url_for(m) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment