Created
July 8, 2013 12:21
-
-
Save xdite/5948350 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
def find_blog | |
case request.host | |
when "www.#{Setting.host}", Setting.host, nil | |
@current_blog = Blog.find_by_subdomain(request.subdomain) | |
else | |
if request.host.index(Setting.host) | |
@current_blog = Blog.find_by_subdomain(request.host.split('.').first) | |
else | |
@current_blog = Blog.find_by_fqdn(request.host) | |
end | |
if !@current_blog | |
redirect_to Setting.domain | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment