Skip to content

Instantly share code, notes, and snippets.

@sborsje
Created November 5, 2009 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sborsje/227473 to your computer and use it in GitHub Desktop.
Save sborsje/227473 to your computer and use it in GitHub Desktop.
# Host based routing - enables routes like:
# map.connect '', :controller => 'blah', :action => 'blah', :conditions => {:host => 'blah'}
#
# Put this file in /config/initializers
module ActionController
module Routing
class Route
def recognition_conditions_with_host
result = recognition_conditions_without_host
result << 'conditions[:host] === env[:host]' if conditions[:host]
result
end
alias_method_chain :recognition_conditions, :host
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment