Skip to content

Instantly share code, notes, and snippets.

@AlphaLiu
Forked from xdite/subdomain-example.rb
Created July 9, 2013 00:54
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 AlphaLiu/5953781 to your computer and use it in GitHub Desktop.
Save AlphaLiu/5953781 to your computer and use it in GitHub Desktop.
# -*- encoding : utf-8 -*-
class Subdomain
def self.matches?(request)
case request.host
when Setting.host, "www.#{Setting.host}", nil
false
else
true
end
end
end
constraints(Subdomain) do
get '/' => 'posts#index'
resources :posts do
collection do
get :search
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment