Created
September 19, 2008 22:48
-
-
Save Bill/11679 to your computer and use it in GitHub Desktop.
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
# by Bill Burcham http://thoughtpropulsion.com | |
# do what you want with this | |
# Add :host variable extraction to Dan Webb's request_routing plugin | |
module Propel | |
module MultiDomainRouting | |
# include this module in RouteSet after request_routing plugin is loaded | |
module ExtractHostParameter | |
def self.included( other) | |
other.alias_method_chain :extract_request_environment, :host | |
# patch corresponding matcher | |
ActionController::Routing::Route::TESTABLE_REQUEST_METHODS << :host | |
end | |
def extract_request_environment_with_host( request ) | |
extract_request_environment_without_host( request ).merge :host => request.host | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment