Skip to content

Instantly share code, notes, and snippets.

@nicolai86
Last active December 11, 2015 15:19
Show Gist options
  • Save nicolai86/4620260 to your computer and use it in GitHub Desktop.
Save nicolai86/4620260 to your computer and use it in GitHub Desktop.
require 'valid_subdomain'
# config/routes
Rails::Application.routes.draw do
constraints(::ApplicationController::ValidSubdomain) do
resource :lol
end
end
# app/controllers/application
class ApplicationController
class ValidSubdomain
def self.matches?(request)
return request.subdomain =~ /tacnol/
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment