Skip to content

Instantly share code, notes, and snippets.

@Bill
Created September 19, 2008 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bill/11679 to your computer and use it in GitHub Desktop.
Save Bill/11679 to your computer and use it in GitHub Desktop.
# 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